summaryrefslogtreecommitdiff
path: root/lib/igt_stats.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-07-27 14:04:17 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-07-27 15:43:25 +0200
commit4755804c56ffe16440edf5e9874234b4ed1c733d (patch)
tree1c1788ec3d99f5b6c57a1177aa9b996fcfcd47df /lib/igt_stats.h
parent1260564c191a2e2de44b3ffb66ff68e72cd031dd (diff)
lib: Update docs for igt_stats
Unfortunately gtkdoc refuses to acknowledge static inlines, so need to nuke them. It probably gets confused by that static ... Also unamed unions confuse gtk-doc, move everything else public up. Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/igt_stats.h')
-rw-r--r--lib/igt_stats.h44
1 files changed, 15 insertions, 29 deletions
diff --git a/lib/igt_stats.h b/lib/igt_stats.h
index 32f376cc..5faeced4 100644
--- a/lib/igt_stats.h
+++ b/lib/igt_stats.h
@@ -32,16 +32,17 @@
/**
* igt_stats_t:
* @values_u64: An array containing pushed integer values
+ * @is_float: Whether @values_f or @values_u64 is valid
* @values_f: An array containing pushed float values
* @n_values: The number of pushed values
*/
typedef struct {
+ unsigned int n_values;
+ unsigned int is_float : 1;
union {
uint64_t *values_u64;
double *values_f;
};
- unsigned int n_values;
- unsigned int is_float : 1;
/*< private >*/
unsigned int capacity;
@@ -81,37 +82,22 @@ 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);
+/**
+ * igt_mean:
+ *
+ * Structure to compute running statistical numbers. Needs to be initialized
+ * with igt_mean_init(). Read out data using igt_mean_get() and
+ * igt_mean_get_variance().
+ */
struct igt_mean {
+ /*< private >*/
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->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)
-{
- return m->mean;
-}
-
-static inline double igt_mean_get_variance(struct igt_mean *m)
-{
- return m->sq / m->count;
-}
+void igt_mean_init(struct igt_mean *m);
+void igt_mean_add(struct igt_mean *m, double v);
+double igt_mean_get(struct igt_mean *m);
+double igt_mean_get_variance(struct igt_mean *m);
#endif /* __IGT_STATS_H__ */