summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhina Sree <69635948+abhina-sree@users.noreply.github.com>2024-01-05 07:57:07 -0500
committerGitHub <noreply@github.com>2024-01-05 07:57:07 -0500
commit70e67253d60a984bd83844690791a023448e3623 (patch)
treeee78e495dd788b37c9ce239cd9ab5e37eabd39d8
parent86127305d4602801ba7ffdc74377ed67b18819ac (diff)
[System][z/OS] Fix per-thread timing error on z/OS (#76947)
This patch calls ProcessCPUUsage() for z/OS because we do not support CLOCK_THREAD_CPUTIME_ID. This copies the change made to google benchmark here https://github.com/google/benchmark/commit/e3824e7503187993b287ac8c8144a35bf5ccfd44
-rw-r--r--third-party/benchmark/src/timers.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/third-party/benchmark/src/timers.cc b/third-party/benchmark/src/timers.cc
index 21d3db20da9e..ed35c01f5540 100644
--- a/third-party/benchmark/src/timers.cc
+++ b/third-party/benchmark/src/timers.cc
@@ -168,6 +168,9 @@ double ThreadCPUUsage() {
// RTEMS doesn't support CLOCK_THREAD_CPUTIME_ID. See
// https://github.com/RTEMS/rtems/blob/master/cpukit/posix/src/clockgettime.c
return ProcessCPUUsage();
+#elif defined(BENCHMARK_OS_ZOS)
+ // z/OS doesn't support CLOCK_THREAD_CPUTIME_ID.
+ return ProcessCPUUsage();
#elif defined(BENCHMARK_OS_SOLARIS)
struct rusage ru;
if (getrusage(RUSAGE_LWP, &ru) == 0) return MakeTime(ru);