Commits

Bryan O'Sullivan committed 31b6008

Hack reports into basically working shape. Sort of.

Comments (0)

Files changed (3)

lib/Network/HTTP/LoadTest/Report.hs

 import Paths_pronk (getDataFileName)
 import Prelude hiding (print)
 import Statistics.Resampling.Bootstrap (Estimate(..))
+import Statistics.Sample.KernelDensity (kde)
 import System.IO (Handle)
 import System.IO.Unsafe (unsafePerformIO)
 import Text.Hastache (MuType(..))
 writeReport template h a@Analysis{..} = do
   let context "include" = MuLambdaM $
                           R.includeFile [templateDir, R.templateDir]
+      context "latKdeTimes" = R.vector "x" latKdeTimes
+      context "latKdePDF" = R.vector "x" latKdePDF
+      context "latKde"    = R.vector2 "time" "pdf" latKdeTimes latKdePDF
       context "latValues" = MuList . map mkGenericContext . G.toList $ lats
       context "thrValues" = R.vector "x" thrValues
       context n = mkGenericContext a n
+      (latKdeTimes,latKdePDF) = kde 128 . G.convert . G.map summElapsed $ latValues
       lats = G.map (\s -> s { summStart = summStart s - t }) latValues
           where t = summStart . G.head $ latValues
   tpl <- R.loadTemplate [".",templateDir] template
 description:
   A library and command line tool for HTTP load testing.  You can
   think of this package as similar to `httperf` or `ab`, only more
-  modern, faster, more scalable, easier to deal with, and
-  programmable.
+  modern, faster, more scalable, easier to deal with, programmable,
+  and with customisable output.
   .
   The name "pronk" comes from the Afrikaans verb /pronk-/, meaning
   "to show off" or "to strut".
 license-file:        LICENSE
 author:              Bryan O'Sullivan <bos@serpentine.com>
 maintainer:          Bryan O'Sullivan <bos@serpentine.com>
-copyright:           2011 MailRank, Inc.
+copyright:           (c) 2011 Bryan O'Sullivan
+                     (c) 2011 MailRank, Inc.
 category:            Network
 build-type:          Simple
 cabal-version:       >=1.8
     servers/ping/src/*.hs
 
 data-files:
-  templates/report.tpl
+  templates/*.tpl
 
 flag developer
   description: operate in developer mode

templates/report.tpl

  </head>
     <body>
       <div class="body">
-    <h1>criterion performance measurements</h1>
+    <h1>pronk performance measurements</h1>
 
-<h2>overview</h2>
-
-<div id="overview" class="ovchart" style="width:900px;height:100px;"></div>
-
-{{#report}}
-<h2><a name="b{{number}}">{{name}}</a></h2>
+<h2><a name="b{{number}}">name</a></h2>
  <table width="100%">
   <tbody>
    <tr>
-    <td><div id="kde{{number}}" class="kdechart"
+    <td><div id="kde0" class="kdechart"
              style="width:450px;height:278px;"></div></td>
-    <td><div id="time{{number}}" class="timechart"
+    <td><div id="time0" class="timechart"
              style="width:450px;height:278px;"></div></td>
   </tbody>
  </table>
     ts = ts[0];
     var kq = $("#kde" + number);
     var k = $.plot(kq,
-           [{ label: name + " time densities (" + units + ")",
+           [{ label: name + " latency densities (" + units + ")",
               data: $.zip(kdetimes, kdepdf),
               }],
            { yaxis: { ticks: false },
     for (var i = 0; i < ts.length; i++)
       timepairs[i] = [ts[i],i];
     $.plot($("#time" + number),
-           [{ label: name + " times (" + units + ")",
+           [{ label: name + " latencies (" + units + ")",
               data: timepairs }],
            { points: { show: true },
              grid: { hoverable: true },
     $.addTooltip("#kde" + number, function(x,y) { return x + ' ' + units; });
     $.addTooltip("#time" + number, function(x,y) { return x + ' ' + units; });
   };
-  {{#report}}
-  mangulate({{number}}, "{{name}}",
-            {{anMean.estPoint}},
-            [{{#times}}{{x}},{{/times}}],
-            [{{#kdetimes}}{{x}},{{/kdetimes}}],
-            [{{#kdepdf}}{{x}},{{/kdepdf}}]);
-  {{/report}}
-
-  var benches = [{{#report}}"{{name}}",{{/report}}];
-  var ylabels = [{{#report}}[-{{number}},'<a href="#b{{number}}">{{name}}</a>'],{{/report}}];
-  var means = $.scaleTimes([{{#report}}{{anMean.estPoint}},{{/report}}]);
-  var xs = [];
-  var prev = null;
-  for (var i = 0; i < means[0].length; i++) {
-    var name = benches[i].split(/\//);
-    name.pop();
-    name = name.join('/');
-    if (name != prev) {
-      xs.push({ label: name, data: [[means[0][i], -i]]});
-      prev = name;
-    }
-    else
-      xs[xs.length-1].data.push([means[0][i],-i]);
-  }
-  var oq = $("#overview");
-  o = $.plot(oq, xs, { bars: { show: true, horizontal: true,
-                               barWidth: 0.75, align: "center" },
-                       grid: { hoverable: true },
-                       legend: { show: xs.length > 1 },
-                       xaxis: { max: Math.max.apply(undefined,means[0]) * 1.02 },
-                       yaxis: { ticks: ylabels, tickColor: '#ffffff' } });
-  if (benches.length > 3)
-    o.getPlaceholder().height(28*benches.length);
-  o.resize();
-  o.setupGrid();
-  o.draw();
-  $.addTooltip("#overview", function(x,y) { return x + ' ' + means[1]; });
+  mangulate(0, "name",
+            {{latency.mean}},
+            [{{#latValues}}{{summElapsed}},{{/latValues}}],
+            [{{#latKdeTimes}}{{x}},{{/latKdeTimes}}],
+            [{{#latKdePDF}}{{x}},{{/latKdePDF}}]);
 });
 $(document).ready(function () {
     $(".time").text(function(_, text) {