summaryrefslogtreecommitdiff
path: root/benchmarks/gem_latency.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-12-19 14:51:08 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-12-19 15:07:56 +0000
commitdb011021a1c9c40e4fc3ec7a8c31bfee7b9fb623 (patch)
treefee581d46f459b8ec9141123f4367219cd98f2d0 /benchmarks/gem_latency.c
parent646cab4c0c73dce310ff8020ffb96272647780ba (diff)
benchmarks/gem_latency: Add output field specifier
Just to make it easier to integrate into ezbench. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'benchmarks/gem_latency.c')
-rw-r--r--benchmarks/gem_latency.c26
1 files changed, 22 insertions, 4 deletions
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