From db011021a1c9c40e4fc3ec7a8c31bfee7b9fb623 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 19 Dec 2015 14:51:08 +0000 Subject: benchmarks/gem_latency: Add output field specifier Just to make it easier to integrate into ezbench. Signed-off-by: Chris Wilson --- benchmarks/gem_latency.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'benchmarks/gem_latency.c') diff --git a/benchmarks/gem_latency.c b/benchmarks/gem_latency.c index 40251b77..9e160da5 100644 --- a/benchmarks/gem_latency.c +++ b/benchmarks/gem_latency.c @@ -94,6 +94,8 @@ struct producer { #define HEIGHT 128 #define BCS_TIMESTAMP (0x22000 + 0x358) +#define CYCLES_TO_NS(x) (80*(x)) +#define CYCLES_TO_US(x) (CYCLES_TO_NS(x)/1000.) static uint32_t create_workload(int gen, uint32_t scratch) { @@ -415,9 +417,20 @@ static int run(int seconds, igt_stats_push_float(&latency, l_estimate(&p[n].consumers[m].latency)); } } - printf("%d/%d: %7.3fus %7.3fus\n", complete, nrun, - 80/1000.*l_estimate(&throughput), - 80/1000.*l_estimate(&latency)); + + switch ((flags >> 8) & 0xf) { + default: + printf("%d/%d: %7.3fus %7.3fus\n", complete, nrun, + CYCLES_TO_US(l_estimate(&throughput)), + CYCLES_TO_US(l_estimate(&latency))); + break; + case 1: + printf("%f\n", CYCLES_TO_US(l_estimate(&throughput))); + break; + case 2: + printf("%f\n", CYCLES_TO_US(l_estimate(&latency))); + break; + } return 0; } @@ -432,7 +445,7 @@ int main(int argc, char **argv) unsigned flags = 0; int c; - while ((c = getopt(argc, argv, "p:c:n:w:t:s")) != -1) { + while ((c = getopt(argc, argv, "p:c:n:w:t:f:s")) != -1) { switch (c) { case 'p': /* How many threads generate work? */ @@ -469,6 +482,11 @@ int main(int argc, char **argv) time = 1; break; + case 'f': + /* Select an output field */ + flags |= atoi(optarg) << 8; + break; + case 's': /* Assign each producer to its own context, adding * context switching into the mix (e.g. execlists -- cgit v1.2.3