summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-05-14 07:32:04 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2020-06-19 16:37:11 +0100
commitc874329500167bd12a94242b76523a52a1ebfe9a (patch)
tree9ba49877961c4e0293151c7cc21968dc865313e4 /benchmarks
parentd8f1a651184c956e94fe35e87dbf772ef1e7f851 (diff)
gem_wsim: Show workload timing stats
Show average/min/max workload iteration and dropped period stats when 'p' command is used. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/gem_wsim.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index dc47470c..dd0b2e26 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2117,7 +2117,8 @@ static void *run_workload(void *data)
struct w_step *w;
int throttle = -1;
int qd_throttle = -1;
- int count;
+ int count, missed = 0;
+ unsigned long time_tot = 0, time_min = ULONG_MAX, time_max = 0;
int i;
clock_gettime(CLOCK_MONOTONIC, &t_start);
@@ -2137,12 +2138,19 @@ static void *run_workload(void *data)
do_sleep = w->delay;
} else if (w->type == PERIOD) {
struct timespec now;
+ int elapsed;
clock_gettime(CLOCK_MONOTONIC, &now);
- do_sleep = w->period -
- elapsed_us(&wrk->repeat_start, &now);
+ elapsed = elapsed_us(&wrk->repeat_start, &now);
+ do_sleep = w->period - elapsed;
+ time_tot += elapsed;
+ if (elapsed < time_min)
+ time_min = elapsed;
+ if (elapsed > time_max)
+ time_max = elapsed;
if (do_sleep < 0) {
- if (verbose > 1)
+ missed++;
+ if (verbose > 2)
printf("%u: Dropped period @ %u/%u (%dus late)!\n",
wrk->id, count, i, do_sleep);
continue;
@@ -2296,6 +2304,9 @@ static void *run_workload(void *data)
printf("%c%u: %.3fs elapsed (%d cycles, %.3f workloads/s).",
wrk->background ? ' ' : '*', wrk->id,
t, count, count / t);
+ if (time_tot)
+ printf(" Time avg/min/max=%lu/%lu/%luus; %u missed.",
+ time_tot / count, time_min, time_max, missed);
putchar('\n');
}