]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Perf: Nicer output
authorJan Maria Matejka <mq@ucw.cz>
Wed, 31 Oct 2018 11:02:16 +0000 (12:02 +0100)
committerJan Maria Matejka <mq@ucw.cz>
Mon, 17 Dec 2018 14:16:41 +0000 (15:16 +0100)
doc/bird.sgml
proto/perf/config.Y
proto/perf/parse.pl
proto/perf/perf.c
proto/perf/perf.h

index b9e2d4f29f0bfc48934a1c8a91884e659afa2c54..0d8d6b154b9139f4f7e33aeb1511c5a35800f0bd 100644 (file)
@@ -3783,7 +3783,11 @@ any instance of Perf in production configs.
        <tag><label id="perf-to">exp to <m/number/</tag>
        Stop benchmarking on this exponent. Default: 20
 
-       <tag><label id="perf-threshold">threshold <m/time/</tag>
+       <tag><label id="perf-threshold-min">threshold min <m/time/</tag>
+       If a run for the given exponent took less than this time for route import,
+       increase the exponent immediately. Default: 1 ms
+
+       <tag><label id="perf-threshold-max">threshold max <m/time/</tag>
        If every run for the given exponent took at least this time for route import,
        stop benchmarking. Default: 500 ms
 </descrip>
index c31b34275f3af375f6e4dd702c24b1870f00a86a..52f509a65ab20f5d0b9dc7852fcdd75d77b14514 100644 (file)
@@ -17,7 +17,7 @@ CF_DEFINES
 
 CF_DECLS
 
-CF_KEYWORDS(PERF, EXP, FROM, TO, REPEAT, THRESHOLD, KEEP)
+CF_KEYWORDS(PERF, EXP, FROM, TO, REPEAT, THRESHOLD, MIN, MAX, KEEP)
 
 CF_GRAMMAR
 
@@ -29,7 +29,8 @@ perf_proto_start: proto_start PERF
   PERF_CFG->from = 10;
   PERF_CFG->to = 20;
   PERF_CFG->repeat = 4;
-  PERF_CFG->threshold = 500 MS_;
+  PERF_CFG->threshold_max = 500 MS_;
+  PERF_CFG->threshold_min = 1 MS_;
   PERF_CFG->keep = 0;
 };
 
@@ -43,7 +44,8 @@ perf_proto_item:
  | EXP FROM NUM { PERF_CFG->from = $3; }
  | EXP TO NUM { PERF_CFG->to = $3; }
  | REPEAT NUM { PERF_CFG->repeat = $2; }
- | THRESHOLD expr_us { PERF_CFG->threshold = $2; }
+ | THRESHOLD MIN expr_us { PERF_CFG->threshold_min = $3; }
+ | THRESHOLD MAX expr_us { PERF_CFG->threshold_max = $3; }
  | KEEP bool { PERF_CFG->keep = $2; }
 ;
 
index a24106ddb5eb911c089a0f7d87961f81113ac0de..d91c5654490e24eafce1320bba937bf727e36f72 100755 (executable)
@@ -120,11 +120,15 @@ sub draw {
   my $csv = $self->dump();
   my $svg = $self->stub . ".svg";
 
+  my $title = $self->name;
+  $title =~ s/_/ /g;
+
   open PLOT, "|-", "gnuplot -p";
   print PLOT "set terminal svg;\n";
   print PLOT "set output '$svg';\n";
-  print PLOT "set title '" . $self->name . "';\n";
+  print PLOT "set title '$title';\n";
   print PLOT "set datafile separator ',';\n";
+  print PLOT "set jitter over 0.3 spread 0.3;\n";
   print PLOT "plot '$csv' using 1:2 title 'gen', '$csv' using 1:3 title 'temp', '$csv' using 1:4 title 'update', '$csv' using 1:5 title 'withdraw';\n";
   close PLOT;
 }
index 7cf26a8f7e0dbfa6a0dbc8fe05c0c8b83fb4771c..733eeb880cb821698db73405bea42b781b9c2923 100644 (file)
@@ -186,13 +186,14 @@ perf_loop(void *data)
   s64 updatetime = timediff(&ts_rte, &ts_update);
   s64 withdrawtime = timediff(&ts_update, &ts_withdraw);
 
-  PLOG("exp=%u times: gen=%lu temp=%lu update=%lu withdraw=%lu",
-      p->exp, gentime, temptime, updatetime, withdrawtime);
+  if (updatetime NS >= p->threshold_min)
+    PLOG("exp=%u times: gen=%lu temp=%lu update=%lu withdraw=%lu",
+       p->exp, gentime, temptime, updatetime, withdrawtime);
 
-  if (updatetime NS < p->threshold)
+  if (updatetime NS < p->threshold_max)
     p->stop = 0;
 
-  if (++p->run == p->repeat) {
+  if ((updatetime NS < p->threshold_min) || (++p->run == p->repeat)) {
     xfree(p->data);
     p->data = NULL;
 
@@ -222,7 +223,8 @@ perf_init(struct proto_config *CF)
 
   struct perf_config *cf = (struct perf_config *) CF;
 
-  p->threshold = cf->threshold;
+  p->threshold_min = cf->threshold_min;
+  p->threshold_max = cf->threshold_max;
   p->from = cf->from;
   p->to = cf->to;
   p->repeat = cf->repeat;
index 0e36a158773cf7bf68f1ff47b1f5e9c392f22f07..f31becddc49cb0c401703946dc8e838bc465f5ca 100644 (file)
@@ -11,7 +11,8 @@
 
 struct perf_config {
   struct proto_config p;
-  btime threshold;
+  btime threshold_min;
+  btime threshold_max;
   uint from;
   uint to;
   uint repeat;
@@ -23,7 +24,8 @@ struct perf_proto {
   struct ifa *ifa;
   void *data;
   event *loop;
-  btime threshold;
+  btime threshold_min;
+  btime threshold_max;
   uint from;
   uint to;
   uint repeat;