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

Side by Side Diff: trunk/src/base/profiler/tracked_time.cc

Issue 22984005: Revert 217172 "Enable high resolution time for TimeTicks::Now on..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/base/test/test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/profiler/tracked_time.h" 5 #include "base/profiler/tracked_time.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <mmsystem.h> // Declare timeGetTime()... after including build_config. 10 #include <mmsystem.h> // Declare timeGetTime()... after including build_config.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 TrackedTime::TrackedTime(const base::TimeTicks& time) 48 TrackedTime::TrackedTime(const base::TimeTicks& time)
49 : ms_((time - base::TimeTicks()).InMilliseconds()) { 49 : ms_((time - base::TimeTicks()).InMilliseconds()) {
50 } 50 }
51 51
52 // static 52 // static
53 TrackedTime TrackedTime::Now() { 53 TrackedTime TrackedTime::Now() {
54 #if defined(OS_WIN) 54 #if defined(OS_WIN)
55 // Use lock-free accessor to 32 bit time. 55 // Use lock-free accessor to 32 bit time.
56 // Note that TimeTicks::Now() is built on this, so we have "compatible" 56 // Note that TimeTicks::Now() is built on this, so we have "compatible"
57 // times when we down-convert a TimeTicks sample. 57 // times when we down-convert a TimeTicks sample.
58 return TrackedTime(base::TimeTicks::UnprotectedNow()); 58 // TODO(jar): Surface this interface via something in base/time/time.h.
59 return TrackedTime(static_cast<int32>(timeGetTime()));
59 #else 60 #else
60 // Posix has nice cheap 64 bit times, so we just down-convert it. 61 // Posix has nice cheap 64 bit times, so we just down-convert it.
61 return TrackedTime(base::TimeTicks::Now()); 62 return TrackedTime(base::TimeTicks::Now());
62 #endif // OS_WIN 63 #endif // OS_WIN
63 } 64 }
64 65
65 Duration TrackedTime::operator-(const TrackedTime& other) const { 66 Duration TrackedTime::operator-(const TrackedTime& other) const {
66 return Duration(ms_ - other.ms_); 67 return Duration(ms_ - other.ms_);
67 } 68 }
68 69
69 TrackedTime TrackedTime::operator+(const Duration& other) const { 70 TrackedTime TrackedTime::operator+(const Duration& other) const {
70 return TrackedTime(ms_ + other.ms_); 71 return TrackedTime(ms_ + other.ms_);
71 } 72 }
72 73
73 bool TrackedTime::is_null() const { return ms_ == 0; } 74 bool TrackedTime::is_null() const { return ms_ == 0; }
74 75
75 } // namespace tracked_objects 76 } // namespace tracked_objects
OLDNEW
« no previous file with comments | « no previous file | trunk/src/base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698