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}
This commit is contained in:
lpy 2016-05-26 21:23:21 -07:00 committed by Commit bot
parent 37d3ad89b6
commit 1332be4ab4

View File

@ -41,9 +41,11 @@ int64_t ComputeThreadTicks() {
CHECK(kr == KERN_SUCCESS); CHECK(kr == KERN_SUCCESS);
v8::base::CheckedNumeric<int64_t> absolute_micros( v8::base::CheckedNumeric<int64_t> 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 *= 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(); return absolute_micros.ValueOrDie();
} }
#elif V8_OS_POSIX #elif V8_OS_POSIX