benchmarks/gem_latency: Replace igt_stats with igt_mean

Use a simpler statically allocated struct for computing the mean as
otherwise we many run out of memeory!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2016-03-08 14:10:56 +00:00
parent 3a7325e498
commit 74761382b3
2 changed files with 40 additions and 12 deletions
+27
View File
@@ -80,4 +80,31 @@ double igt_stats_get_median(igt_stats_t *stats);
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;
unsigned long count;
};
static inline void igt_mean_init(struct igt_mean *m)
{
memset(m, 0, sizeof(*m));
}
static inline void igt_mean_add(struct igt_mean *m, double v)
{
double delta = v - m->mean;
m->mean += delta / m->count++;
m->sq += delta * (v - m->mean);
}
static inline double igt_mean_get(struct igt_mean *m)
{
return m->mean;
}
static inline double igt_mean_get_variance(struct igt_mean *m)
{
return m->sq / m->count;
}
#endif /* __IGT_STATS_H__ */