From patchwork Wed Sep 11 12:27:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 19969 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D242248D9 for ; Wed, 11 Sep 2013 12:27:56 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id 6sf10754994qea.3 for ; Wed, 11 Sep 2013 05:27:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=lR0uj3tnd4F9D9vnl/yBSH2fi3T5c/N42KWdXTzPHe8=; b=Y+AS/yNlqQCCCQzZZCjo8ZngrIAkNUVyCHgsBNoYmhl6MkquMUp59auiJukcD2zRhL veTAoNhWE3pX498msiqTVtCMNB0ckPJ1nFeM+p62liqSna6Iqd7U26et6l6UAlOI9m+Y UPiCwPf3k5PATG+o/5KmrRzQC7g4iskUUnv/TeviT06x9Mj1vgDa0HT7Ypax7hmrpUH+ ipSXDejGkdMLFJxtJ7ijASXGch7NqsjVle8QvSgIned6G8Y/FGRoiE4FTprbrJYD1erR 9e1x7g8rGAXRWI5pQMCcrJbjzLGcVaP4M8VyiKJxf8ZcfXHq+njkVWERBvjxYTX0HmT4 hkfQ== X-Received: by 10.236.2.5 with SMTP id 5mr499239yhe.23.1378902475668; Wed, 11 Sep 2013 05:27:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.5.9 with SMTP id o9ls192995qeo.49.gmail; Wed, 11 Sep 2013 05:27:55 -0700 (PDT) X-Received: by 10.220.174.200 with SMTP id u8mr1059120vcz.6.1378902475411; Wed, 11 Sep 2013 05:27:55 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id ur9si5934616veb.41.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Sep 2013 05:27:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id c14so5883300vea.1 for ; Wed, 11 Sep 2013 05:27:55 -0700 (PDT) X-Gm-Message-State: ALoCoQn2CUZgl/Ilw5Eo+XiHZygS7p1ree1CAcViXeIblgyNfZjUzqzK6ALePZhueNtgsm9pWo39 X-Received: by 10.220.74.69 with SMTP id t5mr1063369vcj.18.1378902475333; Wed, 11 Sep 2013 05:27:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp53438vcz; Wed, 11 Sep 2013 05:27:54 -0700 (PDT) X-Received: by 10.204.162.74 with SMTP id u10mr115141bkx.47.1378902474262; Wed, 11 Sep 2013 05:27:54 -0700 (PDT) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) by mx.google.com with ESMTPS id l9si2830275bko.293.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Sep 2013 05:27:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.53 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=209.85.214.53; Received: by mail-bk0-f53.google.com with SMTP id d7so3449699bkh.40 for ; Wed, 11 Sep 2013 05:27:53 -0700 (PDT) X-Received: by 10.204.121.201 with SMTP id i9mr1259748bkr.13.1378902473571; Wed, 11 Sep 2013 05:27:53 -0700 (PDT) Received: from localhost.localdomain (cpc6-seac21-2-0-cust453.7-2.cable.virginmedia.com. [82.1.113.198]) by mx.google.com with ESMTPSA id pw1sm7398365bkb.8.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 11 Sep 2013 05:27:52 -0700 (PDT) Message-ID: <523061C7.9010900@linaro.org> Date: Wed, 11 Sep 2013 13:27:51 +0100 From: Will Newton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: libc-alpha@sourceware.org CC: patches@linaro.org Subject: [PATCH] benchtests: Rename argument to TIMING_INIT macro. X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The TIMING_INIT macro currently sets the number of loop iterations to 1000, which limits usefulness. Make the argument a clock resolution value and multiply by 1000 in bench-skeleton.c instead to allow easier reuse. ChangeLog: 2013-09-11 Will Newton * benchtests/bench-timing.h: Rename iters parameter to res and remove hardcoded 1000 value. * benchtests/bench-skeleton.c: Pass res parameter to TIMING_INIT and multiply by 1000. --- benchtests/bench-skeleton.c | 6 ++++-- benchtests/bench-timing.h | 14 ++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/benchtests/bench-skeleton.c b/benchtests/bench-skeleton.c index 4e3a507..05edc69 100644 --- a/benchtests/bench-skeleton.c +++ b/benchtests/bench-skeleton.c @@ -53,9 +53,11 @@ main (int argc, char **argv) memset (&runtime, 0, sizeof (runtime)); - unsigned long iters; + unsigned long iters, res; - TIMING_INIT (iters); + TIMING_INIT (res); + + iters = 1000 * res; for (int v = 0; v < NUM_VARIANTS; v++) { diff --git a/benchtests/bench-timing.h b/benchtests/bench-timing.h index 009813b..48a8521 100644 --- a/benchtests/bench-timing.h +++ b/benchtests/bench-timing.h @@ -25,10 +25,10 @@ hp_timing_t _dl_hp_timing_overhead; typedef hp_timing_t timing_t; -# define TIMING_INIT(iters) \ +# define TIMING_INIT(res) \ ({ \ HP_TIMING_DIFF_INIT(); \ - (iters) = 1000; \ + (res) = 1; \ }) # define TIMING_NOW(var) HP_TIMING_NOW (var) @@ -43,15 +43,13 @@ typedef hp_timing_t timing_t; #else typedef uint64_t timing_t; -/* Measure 1000 times the resolution of the clock. So for a 1ns - resolution clock, we measure 1000 iterations of the function call at a - time. Measurements close to the minimum clock resolution won't make - much sense, but it's better than having nothing at all. */ -# define TIMING_INIT(iters) \ +/* Measure the resolution of the clock so we can scale the number of + benchmark iterations by this value. */ +# define TIMING_INIT(res) \ ({ \ struct timespec start; \ clock_getres (CLOCK_PROCESS_CPUTIME_ID, &start); \ - (iters) = 1000 * start.tv_nsec; \ + (res) = start.tv_nsec; \ }) # define TIMING_NOW(var) \