summaryrefslogtreecommitdiff
path: root/lib/igt_stats.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-03-09 22:39:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-09 23:40:21 +0000
commit6cd15fb930793f441eaa829bd087ac34e644e492 (patch)
tree5c5142c30ac87cc19a724487a9267074ba82b04c /lib/igt_stats.h
parent0aacdac56fc3179b1fe6bc28bb1a3beb64c64619 (diff)
benchmarks: Add gem_syslatency
Instead of measuring the wakeup latency of a GEM client, we turn the tables here and ask what is the wakeup latency of a normal process competing with GEM. In particular, a realtime process that expects deterministic latency. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_stats.h')
-rw-r--r--lib/igt_stats.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/igt_stats.h b/lib/igt_stats.h
index 105f3fb2..32f376cc 100644
--- a/lib/igt_stats.h
+++ b/lib/igt_stats.h
@@ -27,6 +27,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <math.h>
/**
* igt_stats_t:
@@ -81,20 +82,26 @@ double igt_stats_get_variance(igt_stats_t *stats);
double igt_stats_get_std_deviation(igt_stats_t *stats);
struct igt_mean {
- double mean, sq;
+ double mean, sq, min, max;
unsigned long count;
};
static inline void igt_mean_init(struct igt_mean *m)
{
memset(m, 0, sizeof(*m));
+ m->max = -HUGE_VAL;
+ m->min = HUGE_VAL;
}
static inline void igt_mean_add(struct igt_mean *m, double v)
{
double delta = v - m->mean;
- m->mean += delta / m->count++;
+ m->mean += delta / ++m->count;
m->sq += delta * (v - m->mean);
+ if (v < m->min)
+ m->min = v;
+ if (v > m->max)
+ m->max = v;
}
static inline double igt_mean_get(struct igt_mean *m)