summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2015-05-12 16:29:32 +0300
committerImre Deak <imre.deak@intel.com>2015-05-19 11:35:55 +0300
commita572fb15f350be2c002b53a97cae6ceefb155df8 (patch)
tree887e84fe4f970a3f4ee21132a6b0d65fdd21e656 /tests
parent5253af92ad6811d7c02b75355b3a47a60961b60a (diff)
tests/pm_rc6_residency: simplify the residency counter check
The temporary vars only obfuscated things, so get rid of them. Also remove some redundant asserts and info messages. The only functional change is that the counter delta will be checked only against a percentage based accuracy range (90%-100%) and not against a hard-coded limit (RC6_FUDGE). The two checks serve the same purpose and the former one is clearer. 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.c44
1 files changed, 7 insertions, 37 deletions
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index a945b47c..ad33292d 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -36,7 +36,6 @@
#include "intel_chipset.h"
#define SLEEP_DURATION 3000 // in milliseconds
-#define RC6_FUDGE 900 // in milliseconds
#define CODE_TIME 50 // in microseconfs
static unsigned int readit(const char *path)
@@ -89,46 +88,17 @@ static void read_rc6_residency( int value[], const char *name_of_rc6_residency)
static void residency_accuracy(int value[],const char *name_of_rc6_residency)
{
- unsigned int flag_counter,flag_support;
- double counter_result = 0;
unsigned int diff;
- unsigned int tmp_counter, tmp_support;
- double counter;
- flag_counter = 0;
- flag_support = 0;
- diff = (value[1] - value[0]);
-
- igt_assert_f(diff <= (SLEEP_DURATION + RC6_FUDGE),"Diff was too high. That is unpossible\n");
- igt_assert_f(diff >= (SLEEP_DURATION - RC6_FUDGE),"GPU was not in RC6 long enough. Check that "
- "the GPU is as idle as possible(ie. no X, "
- "running and running no other tests)\n");
-
- counter = ((double)value[1] - (double)value[0]) /(double) (SLEEP_DURATION + CODE_TIME);
-
- if( counter > 0.9 ){
- counter_result = counter;
- tmp_counter = 1;
- }
- else
- tmp_counter = 0;
-
- if( value [1] == 0){
- tmp_support = 0;
- igt_info("This machine/configuration doesn't support %s\n", name_of_rc6_residency);
- }
- else
- tmp_support = 1;
+ double ratio;
- flag_counter = flag_counter + tmp_counter;
- flag_counter = flag_counter << 1;
+ diff = value[1] - value[0];
- flag_support = flag_support + tmp_support;
- flag_support = flag_support << 1;
+ ratio = (double)diff / (SLEEP_DURATION + CODE_TIME);
- igt_info("The residency counter: %f \n", counter_result);
- igt_skip_on_f(flag_support == 0 , "This machine didn't entry %s state.\n", name_of_rc6_residency);
- igt_assert_f((flag_counter != 0) && (counter_result <=1) , "Sysfs RC6 residency counter is inaccurate.\n");
- igt_info("This machine entry %s state.\n", name_of_rc6_residency);
+ igt_info("Residency in %s or deeper state: %u ms (ratio to expected duration: %.02f)\n",
+ name_of_rc6_residency, diff, ratio);
+ igt_assert_f(ratio > 0.9 && ratio <= 1,
+ "Sysfs RC6 residency counter is inaccurate.\n");
}
igt_main