Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: src/base/cpu.cc

Issue 1977983003: [base] Implement CPU time on Windows. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/base/cpu.cc
diff --git a/src/base/cpu.cc b/src/base/cpu.cc
index 12a38819197a90aa4d91dfbbef86aa64cb1f3455..bd32fb413b0343d39318868f60b3e0e814303cb8 100644
--- a/src/base/cpu.cc
+++ b/src/base/cpu.cc
@@ -338,7 +338,8 @@ CPU::CPU()
has_vfp_(false),
has_vfp3_(false),
has_vfp3_d32_(false),
- is_fp64_mode_(false) {
+ is_fp64_mode_(false),
+ has_non_stop_time_stamp_counter_(false) {
memcpy(vendor_, "Unknown", 8);
#if V8_OS_NACL
// Portable host shouldn't do feature detection.
@@ -419,6 +420,13 @@ CPU::CPU()
has_sahf_ = (cpu_info[2] & 0x00000001) != 0;
}
+ // Check if CPU has non stoppable Time Stamp Counter.
fmeawad 2016/05/26 16:40:34 nit: time stamp counter
lpy 2016/05/26 20:50:55 Done.
+ const int parameter_containing_non_stop_time_stamp_counter = 0x80000007;
+ if (num_ext_ids >= parameter_containing_non_stop_time_stamp_counter) {
+ __cpuid(cpu_info, parameter_containing_non_stop_time_stamp_counter);
+ has_non_stop_time_stamp_counter_ = (cpu_info[3] & (1 << 8)) != 0;
+ }
+
#elif V8_HOST_ARCH_ARM
#if V8_OS_LINUX
« no previous file with comments | « src/base/cpu.h ('k') | src/base/platform/time.h » ('j') | src/base/win32-headers.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698