ART: Report cputime in dex2oat
Add ProcessCpuNanoTime. Log cputime in dex2oat completion message.
Sample:
dex2oat took 20.036s(64.843s cpu) (threads: 48) arena alloc=25MB (26760672B) java alloc=2MB (2311688B) native alloc=44MB (46792784B) free=35MB (37502896B)
Test: m test-art-host
Change-Id: I78646c4808c8205f7f8e7995a82a1ba63cd15298
diff --git a/runtime/base/time_utils.cc b/runtime/base/time_utils.cc
index 3e5bac8..57f198d 100644
--- a/runtime/base/time_utils.cc
+++ b/runtime/base/time_utils.cc
@@ -167,6 +167,17 @@
#endif
}
+uint64_t ProcessCpuNanoTime() {
+#if defined(__linux__)
+ timespec now;
+ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &now);
+ return static_cast<uint64_t>(now.tv_sec) * UINT64_C(1000000000) + now.tv_nsec;
+#else
+ UNIMPLEMENTED(WARNING);
+ return -1;
+#endif
+}
+
void NanoSleep(uint64_t ns) {
timespec tm;
tm.tv_sec = ns / MsToNs(1000);