aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.trace
diff options
context:
space:
mode:
authorWei-cheng Wang <cole945@gmail.com>2015-08-21 01:32:18 +0800
committerMarcin Koƛcielnicki <koriakin@0x04.net>2016-02-18 20:23:00 +0100
commitfbb7bcbeaad3aebab8935cb4ee5706017b3b9e71 (patch)
treebfdae3eec34ebb8bc4e83a2d5368a14e686ba4bc /gdb/testsuite/gdb.trace
parentf79a3bae8725dfe0e11b04ddfc6e6bc8f23e4e4e (diff)
downloadgdb-fbb7bcbeaad3aebab8935cb4ee5706017b3b9e71.zip
gdb-fbb7bcbeaad3aebab8935cb4ee5706017b3b9e71.tar.gz
gdb-fbb7bcbeaad3aebab8935cb4ee5706017b3b9e71.tar.bz2
Determine the iteration count based on wallclock instead of user+system time.
gdb/testsuite/ChangeLog: 2016-02-18 Wei-cheng Wang <cole945@gmail.com> * 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.
Diffstat (limited to 'gdb/testsuite/gdb.trace')
-rw-r--r--gdb/testsuite/gdb.trace/tspeed.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c
index a379411..5746104 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);