mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-06 09:01:53 +00:00
Perf: Nicer output
This commit is contained in:
parent
d13fa8c0d3
commit
07d82fb52a
@ -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>
|
||||
|
@ -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; }
|
||||
;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user