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.
This commit is contained in:
Wei-cheng Wang 2015-08-21 01:32:18 +08:00 committed by Marcin Kościelnicki
parent f79a3bae87
commit fbb7bcbeaa
2 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,10 @@
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.
2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com> 2016-02-18 Walfred Tedeschi <walfred.tedeschi@intel.com>
* gdb.arch/i386-mpx-sigsegv.c: New file. * gdb.arch/i386-mpx-sigsegv.c: New file.

View File

@ -56,13 +56,9 @@ int nspertp = 0;
unsigned long long unsigned long long
myclock () myclock ()
{ {
struct timeval tm, tm2; struct timeval tm;
struct rusage ru; gettimeofday (&tm, NULL);
getrusage (RUSAGE_SELF, &ru); return (((unsigned long long) tm.tv_sec) * 1000000) + tm.tv_usec;
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;
} }
int int
@ -162,9 +158,9 @@ trace_speed_test (void)
return -1; return -1;
if (idelta > mindelta if (idelta > mindelta
/* Total test time should be between 2 and 5 seconds. */ /* Total test time should be between 15 and 30 seconds. */
&& (total1 + total2) > (2 * 1000000) && (total1 + total2) > (15 * 1000000)
&& (total1 + total2) < (5 * 1000000)) && (total1 + total2) < (30 * 1000000))
{ {
nsdelta = (((unsigned long long) idelta) * 1000) / iters; nsdelta = (((unsigned long long) idelta) * 1000) / iters;
printf ("Second loop took %d ns longer per iter than first\n", nsdelta); printf ("Second loop took %d ns longer per iter than first\n", nsdelta);