From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH v2 3/3] tests: rc6 residency test Date: Tue, 27 Mar 2012 10:34:08 +0200 Message-ID: <20120327083408.GD4276@phenom.ffwll.local> References: <1332722012-4853-1-git-send-email-ben@bwidawsk.net> <1332722012-4853-6-git-send-email-ben@bwidawsk.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 958279EBEF for ; Tue, 27 Mar 2012 01:33:25 -0700 (PDT) Received: by wibhj13 with SMTP id hj13so4035777wib.12 for ; Tue, 27 Mar 2012 01:33:24 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1332722012-4853-6-git-send-email-ben@bwidawsk.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Ben Widawsky Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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@ffwll.ch Mobile: +41 (0)79 365 57 48