From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33347 invoked by alias); 23 Aug 2015 16:17:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 33243 invoked by uid 89); 23 Aug 2015 16:17:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f50.google.com Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 23 Aug 2015 16:17:06 +0000 Received: by pawq9 with SMTP id q9so86841580paw.3 for ; Sun, 23 Aug 2015 09:17:04 -0700 (PDT) X-Received: by 10.68.142.130 with SMTP id rw2mr36832965pbb.107.1440346624757; Sun, 23 Aug 2015 09:17:04 -0700 (PDT) Received: from localhost.localdomain (114-32-204-230.HINET-IP.hinet.net. [114.32.204.230]) by smtp.gmail.com with ESMTPSA id pj3sm14417936pdb.6.2015.08.23.09.17.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Aug 2015 09:17:04 -0700 (PDT) From: Wei-cheng Wang To: uweigand@de.ibm.com, gdb-patches@sourceware.org, cole945@gmail.com Subject: [PATCH 2/2] Determine the iteration count based on wallclock instead of user+system time. Date: Sun, 23 Aug 2015 16:17:00 -0000 Message-Id: <1440091938-42453-2-git-send-email-cole945@gmail.com> In-Reply-To: <1440091938-42453-1-git-send-email-cole945@gmail.com> References: <1440091938-42453-1-git-send-email-cole945@gmail.com> X-SW-Source: 2015-08/txt/msg00658.txt.bz2 Hi Ulrich, This patch will combine with "Tracepoint for ppc64" into one patch. Is this ok? Thanks, Wei-cheng --- gdb/testsuite/ChangeLog 2015-08-23 Wei-cheng Wang * gdb.trace/tspeed.c (myclock): Return wallclock instead of user+system time. (trace_speed_test): Determine the iteration count for a time between 15..30 seconds. --- gdb/testsuite/gdb.trace/tspeed.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c index ca4c7bf..c9e212c 100644 --- a/gdb/testsuite/gdb.trace/tspeed.c +++ b/gdb/testsuite/gdb.trace/tspeed.c @@ -56,13 +56,9 @@ int nspertp = 0; unsigned long long myclock () { - struct timeval tm, tm2; - struct rusage ru; - getrusage (RUSAGE_SELF, &ru); - tm = ru.ru_utime; - tm2 = ru.ru_stime; - return (((unsigned long long) tm.tv_sec) * 1000000) + tm.tv_usec - + (((unsigned long long) tm2.tv_sec) * 1000000) + tm2.tv_usec; + struct timeval tm; + gettimeofday (&tm, NULL); + return (((unsigned long long) tm.tv_sec) * 1000000) + tm.tv_usec; } int @@ -162,9 +158,9 @@ trace_speed_test (void) return -1; if (idelta > mindelta - /* Total test time should be between 2 and 5 seconds. */ - && (total1 + total2) > (2 * 1000000) - && (total1 + total2) < (5 * 1000000)) + /* Total test time should be between 15 and 30 seconds. */ + && (total1 + total2) > (15 * 1000000) + && (total1 + total2) < (30 * 1000000)) { nsdelta = (((unsigned long long) idelta) * 1000) / iters; printf ("Second loop took %d ns longer per iter than first\n", nsdelta); -- 1.9.1