Replace CLOCK_MONOTONIC with SYSTEM_TIME_MONOTONIC
Using SYSTEM_TIME_MONOTONIC works for Android (where it translates to
CLOCK_MONOTONIC) and host targets, while CLOCK_MONOTONIC is not defined
on macOS.
Bug: 117921091
Test: existing tests should pass
Change-Id: I1fad472881830fb0701a320cf37319e083932ad4
diff --git a/libs/hwui/tests/macrobench/TestSceneRunner.cpp b/libs/hwui/tests/macrobench/TestSceneRunner.cpp
index 9c845f0..22d5abb 100644
--- a/libs/hwui/tests/macrobench/TestSceneRunner.cpp
+++ b/libs/hwui/tests/macrobench/TestSceneRunner.cpp
@@ -146,7 +146,7 @@
}
for (int i = 0; i < warmupFrameCount; i++) {
testContext.waitForVsync();
- nsecs_t vsync = systemTime(CLOCK_MONOTONIC);
+ nsecs_t vsync = systemTime(SYSTEM_TIME_MONOTONIC);
UiFrameInfoBuilder(proxy->frameInfo()).setVsync(vsync, vsync);
proxy->syncAndDrawFrame();
}
@@ -161,10 +161,10 @@
ModifiedMovingAverage<double> avgMs(opts.reportFrametimeWeight);
- nsecs_t start = systemTime(CLOCK_MONOTONIC);
+ nsecs_t start = systemTime(SYSTEM_TIME_MONOTONIC);
for (int i = 0; i < opts.count; i++) {
testContext.waitForVsync();
- nsecs_t vsync = systemTime(CLOCK_MONOTONIC);
+ nsecs_t vsync = systemTime(SYSTEM_TIME_MONOTONIC);
{
ATRACE_NAME("UI-Draw Frame");
UiFrameInfoBuilder(proxy->frameInfo()).setVsync(vsync, vsync);
@@ -173,7 +173,7 @@
}
if (opts.reportFrametimeWeight) {
proxy->fence();
- nsecs_t done = systemTime(CLOCK_MONOTONIC);
+ nsecs_t done = systemTime(SYSTEM_TIME_MONOTONIC);
avgMs.add((done - vsync) / 1000000.0);
if (i % 10 == 9) {
printf("Average frametime %.3fms\n", avgMs.average());
@@ -181,7 +181,7 @@
}
}
proxy->fence();
- nsecs_t end = systemTime(CLOCK_MONOTONIC);
+ nsecs_t end = systemTime(SYSTEM_TIME_MONOTONIC);
if (reporter) {
outputBenchmarkReport(info, opts, reporter, proxy.get(), (end - start) / (double)s2ns(1));