[Intel-gfx] [PATCH v2 3/3] tests: rc6 residency test

Daniel Vetter daniel at ffwll.ch
Tue Mar 27 10:34:08 CEST 2012


On Sun, Mar 25, 2012 at 05:33:32PM -0700, Ben Widawsky wrote:
> +int main(int argc, char *argv[])
> +{
> +	const int device = drm_get_card(0);
> +	char *path, *pathp, *pathpp;
> +	int fd, ret;
> +	unsigned int value1, value1p, value1pp, value2, value2p, value2pp;
> +	int diff;
> +
> +	/* Use drm_open_any to verify device existence */
> +	fd = drm_open_any();
> +	close(fd);
> +
> +	ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6", device);
> +	assert(ret != -1);
> +	ret = asprintf(&pathp, "/sys/class/drm/card%d/power/rc6p", device);
> +	assert(ret != -1);
> +	ret = asprintf(&pathpp, "/sys/class/drm/card%d/power/rc6pp", device);
> +	assert(ret != -1);
> +
> +	value1 = readit(path);
> +	value1p = readit(pathp);
> +	value1pp = readit(pathpp);
> +	// Sleep for 3 seconds and compare
> +	sleep(3);
> +	value2 = readit(path);
> +	value2p = readit(pathp);
> +	value2pp = readit(pathpp);
> +
> +	diff = (value2pp - value1pp) +
> +		(value2p - value1p) +
> +		(value2 - value1);
> +
> +	/* Plenty of fudge */
> +	if (diff > 3900 || diff < 2100) {
> +		printf("%d\n", diff);

While I bitch around: A slightly more informative error message could be
usueful ;-)

Cheers, Daniel
-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48



More information about the Intel-gfx mailing list