summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2015-05-15 17:29:37 +0300
committerImre Deak <imre.deak@intel.com>2015-05-19 11:35:55 +0300
commit2b47e219be73bb03993fc0d0a78dd7db93c3321b (patch)
tree6c70297bf16567a5469d641302893b019597a492 /tests
parent05e9edb2b938143677254cab1d122cd8b0ecd4c0 (diff)
tests/pm_rc6_residency: fix counter readout in case of wrap-around
Signed-off-by: Imre Deak <imre.deak@intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests')
-rw-r--r--tests/pm_rc6_residency.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index 7c893629..54a6b10b 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -131,6 +131,7 @@ static void measure_residencies(int devid, unsigned int rc6_mask,
{
struct residencies start = { };
struct residencies end = { };
+ int retry;
if (!rc6_mask)
return;
@@ -141,9 +142,21 @@ static void measure_residencies(int devid, unsigned int rc6_mask,
*/
sleep(8);
- read_residencies(devid, rc6_mask, &start);
- sleep(SLEEP_DURATION / 1000);
- read_residencies(devid, rc6_mask, &end);
+ /*
+ * Retry in case of counter wrap-around. We simply re-run the
+ * measurement, since the valid counter range is different on
+ * different platforms and so fixing it up would be non-trivial.
+ */
+ for (retry = 0; retry < 2; retry++) {
+ read_residencies(devid, rc6_mask, &start);
+ sleep(SLEEP_DURATION / 1000);
+ read_residencies(devid, rc6_mask, &end);
+
+ if (end.rc6 >= start.rc6 && end.media_rc6 >= start.media_rc6 &&
+ end.rc6p >= start.rc6p && end.rc6pp >= start.rc6pp)
+ break;
+ }
+ igt_assert_f(retry < 2, "residency values are not consistent\n");
res->rc6 = end.rc6 - start.rc6;
res->rc6p = end.rc6p - start.rc6p;