From 1332be4ab46ab54afe47d2f2f9cdb2b047448eab Mon Sep 17 00:00:00 2001 From: lpy Date: Thu, 26 May 2016 21:23:21 -0700 Subject: [PATCH] Add missing system time in Mac ThreadTicks. Currently Mac ComputeThreadTicks only uses user time, this patch adds system time in order to get more accurate CPU time. BUG=v8:4984 LOG=n Review-Url: https://codereview.chromium.org/2016513002 Cr-Commit-Position: refs/heads/master@{#36538} --- src/base/platform/time.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/base/platform/time.cc b/src/base/platform/time.cc index b2355a33bd..0e4df010ba 100644 --- a/src/base/platform/time.cc +++ b/src/base/platform/time.cc @@ -41,9 +41,11 @@ int64_t ComputeThreadTicks() { CHECK(kr == KERN_SUCCESS); v8::base::CheckedNumeric absolute_micros( - thread_info_data.user_time.seconds); + thread_info_data.user_time.seconds + + thread_info_data.system_time.seconds); absolute_micros *= v8::base::Time::kMicrosecondsPerSecond; - absolute_micros += thread_info_data.user_time.microseconds; + absolute_micros += (thread_info_data.user_time.microseconds + + thread_info_data.system_time.microseconds); return absolute_micros.ValueOrDie(); } #elif V8_OS_POSIX