Example #1
0
import subprocess
import sys
import responseTimeGraph

results = responseTimeGraph.loadResults(sys.argv[1])[0]
htmlOut = sys.argv[2]

lastTick = None

HDR_HISTOGRAM_PATH = '/l/HdrHistogram'

EVERY_SEC = 10

PCT = .99

pending = []

graphData = []

chartHeader = '''
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
'''

chartFooter = '''        ]);
Example #2
0
def graph(rowPoint, logsDir, warmupSec, names, fileName, maxQPS=None):

  allQPS = set()

  points = {}

  for name in names:

    reQPS = re.compile(r'^%s\.qps(\d+)$' % re.escape(name))

    for f in os.listdir(logsDir):
      m = reQPS.match(f)
      resultsFile = '%s/%s/results.pk' % (logsDir, f)
      if not os.path.exists(resultsFile):
        resultsFile = '%s/%s/results.bin' % (logsDir, f)
        
      if m is not None and os.path.exists(resultsFile):
        qps = int(m.group(1))
        if maxQPS is not None and qps > maxQPS:
          print 'SKIPPING %s qps' % qps
          continue

        allQPS.add(qps)
        results = responseTimeGraph.loadResults(resultsFile)

        # Discard first warmupSec seconds:
        upto = 0
        while results[upto][0] < warmupSec:
          upto += 1

        results = results[upto:]

        responseTimes = [x[2] for x in results]
        responseTimes.sort()

        if rowPoint == 'min':
          t = responseTimes[0]
        elif rowPoint == 'max':
          t = responseTimes[-1]
        else:
          pct, minCount = logPoints[rowPoint]
          if len(responseTimes) < minCount:
            raise RuntimeError('%s doesn\'t have enough enough data' % name)
          idx = int(((100.0-pct)/100.0)*len(responseTimes))
          # TODO: should we take linear blend of the two points...?  Else
          # we have a sparseness problem...
          t = responseTimes[-idx-1]

        points[(name, qps)] = t
        if sla is not None and t <= sla:
          passesSLA.add(name)

  qpsList = list(allQPS)
  qpsList.sort()

  cleanName = {'OracleCMS': 'CMS',
               'OracleCMSMMap': 'CMS + MMap',
               'OracleCMSMMapDir': 'CMS + MMap'}

  print 'names: %s; cleaned %s' % (names, (', '.join("'%s'" % cleanName.get(x, x) for x in names)))
  
  l = []
  w = l.append
  w("['QPS', %s],\n" % (', '.join("'%s'" % cleanName.get(x, x) for x in names)))
  for qps in qpsList:
    row = ['%d' % qps]
    for name in names:
      try:
        s = '%.1f' % points[(name, qps)]
      except KeyError:
        s = ''
      row.append(s)
    w('[%s],\n' % ','.join(row))

  if rowPoint == 'max':
    p = 'Max'
  elif rowPoint == 'min':
    p = 'Min'
  else:
    p = '%g%%' % logPoints[rowPoint][0]
    
  html = graphHeader + ''.join(l) + graphFooter % p
  open(fileName, 'wb').write(html)
  print '  saved %s' % fileName
import subprocess
import sys
import responseTimeGraph

results = responseTimeGraph.loadResults(sys.argv[1])[0]
htmlOut = sys.argv[2]

lastTick = None

HDR_HISTOGRAM_PATH = '/l/HdrHistogram'

EVERY_SEC = 10

PCT = .99

pending = []

graphData = []

chartHeader = '''
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
'''

chartFooter = '''        ]);