summaryrefslogtreecommitdiff
path: root/lib/igt_stats.c
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2015-06-27 11:12:01 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2015-06-27 16:04:07 +0100
commit0e4c175e04abadc1f0f76e3c144debf1527cf057 (patch)
treefb6ca7d53caba7ff0deb94ba09ce2b6fe76ddf7b /lib/igt_stats.c
parent4a89a841a11cb872f9b0b0959c306fcb96f87d75 (diff)
stats: Add igt_stats_get_range()
Somewhat useful, for instance to size an histogram. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'lib/igt_stats.c')
-rw-r--r--lib/igt_stats.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/igt_stats.c b/lib/igt_stats.c
index 477d2043..26e4fbf9 100644
--- a/lib/igt_stats.c
+++ b/lib/igt_stats.c
@@ -187,6 +187,22 @@ uint64_t igt_stats_get_max(igt_stats_t *stats)
return stats->max;
}
+/**
+ * igt_stats_get_range:
+ * @stats: An #igt_stats_t instance
+ *
+ * Retrieves the range of the values in @stats. The range is the difference
+ * between the highest and the lowest value.
+ *
+ * The range can be a deceiving characterization of the values, because there
+ * can be extreme minimal and maximum values that are just anomalies. Prefer
+ * the interquatile range or an histogram.
+ */
+uint64_t igt_stats_get_range(igt_stats_t *stats)
+{
+ return igt_stats_get_max(stats) - igt_stats_get_min(stats);
+}
+
/*
* Algorithm popularised by Knuth in:
*