tetst/pm_rc6_residency: sanitize counter check function arguments

The counter check function (residency_accuracy) cares only about the
counter delta, so no need to pass it the start/stop values separately.
Simplify things to prepare for the upcoming patches.

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Imre Deak 2015-05-15 16:15:33 +03:00
parent a572fb15f3
commit 7883bc8c1c

View File

@ -54,13 +54,14 @@ static unsigned int readit(const char *path)
return ret; return ret;
} }
static void read_rc6_residency( int value[], const char *name_of_rc6_residency) static int read_rc6_residency(const char *name_of_rc6_residency)
{ {
unsigned int i; unsigned int i;
const int device = drm_get_card(); const int device = drm_get_card();
char *path ; char *path ;
int ret; int ret;
FILE *file; FILE *file;
int value[2];
/* For some reason my ivb isn't idle even after syncing up with the gpu. /* For some reason my ivb isn't idle even after syncing up with the gpu.
* Let's add a sleept just to make it happy. */ * Let's add a sleept just to make it happy. */
@ -84,15 +85,15 @@ static void read_rc6_residency( int value[], const char *name_of_rc6_residency)
value[i] = readit(path); value[i] = readit(path);
} }
free(path); free(path);
return value[1] - value[0];
} }
static void residency_accuracy(int value[],const char *name_of_rc6_residency) static void residency_accuracy(unsigned int diff,
const char *name_of_rc6_residency)
{ {
unsigned int diff;
double ratio; double ratio;
diff = value[1] - value[0];
ratio = (double)diff / (SLEEP_DURATION + CODE_TIME); ratio = (double)diff / (SLEEP_DURATION + CODE_TIME);
igt_info("Residency in %s or deeper state: %u ms (ratio to expected duration: %.02f)\n", igt_info("Residency in %s or deeper state: %u ms (ratio to expected duration: %.02f)\n",
@ -105,7 +106,7 @@ igt_main
{ {
int fd; int fd;
int devid = 0; int devid = 0;
int rc6[2], rc6p[2], rc6pp[2], media[2]; int rc6, rc6p, rc6pp, media;
igt_skip_on_simulation(); igt_skip_on_simulation();
@ -115,13 +116,13 @@ igt_main
devid = intel_get_drm_devid(fd); devid = intel_get_drm_devid(fd);
close(fd); close(fd);
read_rc6_residency(rc6, "rc6"); rc6 = read_rc6_residency("rc6");
if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))
read_rc6_residency(media, "media_rc6"); media = read_rc6_residency("media_rc6");
if (IS_GEN6(devid) || IS_IVYBRIDGE(devid)) { if (IS_GEN6(devid) || IS_IVYBRIDGE(devid)) {
read_rc6_residency(rc6p, "rc6p"); rc6p = read_rc6_residency("rc6p");
read_rc6_residency(rc6pp, "rc6pp"); rc6pp = read_rc6_residency("rc6pp");
} }
} }