aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-11-13 16:47:04 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2024-11-13 20:21:38 +0000
commit19d0720f68c2617f1b9b686d3884333b60ca75da (patch)
treef97be3d98a0906b99891861bfb0d0f7acf7ddd4d
parentde10b4fc49516e393947c3d6c16de5703e5b2052 (diff)
downloadgcc-19d0720f68c2617f1b9b686d3884333b60ca75da.zip
gcc-19d0720f68c2617f1b9b686d3884333b60ca75da.tar.gz
gcc-19d0720f68c2617f1b9b686d3884333b60ca75da.tar.bz2
libstdc++: Fix calculation of system time in performance tests
The system_time() function used the wrong element of the splits array. Also add a comment about the units for time measurements. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_performance.h (time_counter): Add comment about times. (time_counter::system_time): Use correct split value.
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_performance.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/libstdc++-v3/testsuite/util/testsuite_performance.h b/libstdc++-v3/testsuite/util/testsuite_performance.h
index 4fd95b7..c2be9c8 100644
--- a/libstdc++-v3/testsuite/util/testsuite_performance.h
+++ b/libstdc++-v3/testsuite/util/testsuite_performance.h
@@ -73,6 +73,9 @@ namespace __gnu_test
class time_counter
{
private:
+ // All times are measured in clock ticks.
+ // There are CLOCKS_PER_SEC ticks per second.
+ // POSIX requires CLOCKS_PER_SEC == 1000000 so ticks == microseconds.
clock_t elapsed_begin;
clock_t elapsed_end;
tms tms_begin;
@@ -136,7 +139,7 @@ namespace __gnu_test
std::size_t
system_time() const
- { return (tms_end.tms_stime - tms_begin.tms_stime) + splits[1]; }
+ { return (tms_end.tms_stime - tms_begin.tms_stime) + splits[2]; }
};
class resource_counter