summaryrefslogtreecommitdiff
path: root/lib/igt_stats.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-07-19 15:01:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-07-19 15:30:23 +0100
commit8506cdcaa59ba90fcccda762d9307528d9f4c5c7 (patch)
treed5c679c4418fdf37b475d1779461b7dd98fb8130 /lib/igt_stats.h
parentfdefdd48f61b39d2af825ccdba11fafcaf58031a (diff)
lib: Allow storing floating point values in igt_stats
We don't always have precise integers with which to store, so allow degrading to double precision floating point based on available input. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_stats.h')
-rw-r--r--lib/igt_stats.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/igt_stats.h b/lib/igt_stats.h
index 554ab158..0dc065f4 100644
--- a/lib/igt_stats.h
+++ b/lib/igt_stats.h
@@ -34,17 +34,27 @@
* @n_values: The number of pushed values
*/
typedef struct {
- uint64_t *values;
+ union {
+ uint64_t *values_u64;
+ double *values_f;
+ };
unsigned int n_values;
+ unsigned int is_float : 1;
/*< private >*/
unsigned int capacity;
unsigned int is_population : 1;
unsigned int mean_variance_valid : 1;
unsigned int sorted_array_valid : 1;
+
uint64_t min, max;
+ double range[2];
double mean, variance;
- uint64_t *sorted;
+
+ union {
+ uint64_t *sorted_u64;
+ double *sorted_f;
+ };
} igt_stats_t;
void igt_stats_init(igt_stats_t *stats);
@@ -53,6 +63,7 @@ void igt_stats_fini(igt_stats_t *stats);
bool igt_stats_is_population(igt_stats_t *stats);
void igt_stats_set_population(igt_stats_t *stats, bool full_population);
void igt_stats_push(igt_stats_t *stats, uint64_t value);
+void igt_stats_push_float(igt_stats_t *stats, double value);
void igt_stats_push_array(igt_stats_t *stats,
const uint64_t *values, unsigned int n_values);
uint64_t igt_stats_get_min(igt_stats_t *stats);