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

Unified Diff: runtime/vm/timeline.cc

Issue 1504523002: Use a monotonic clock in the implementation of Stopwatch. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « runtime/vm/timeline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline.cc
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index 331fb52ff8ec09470bccb54c1c28e5c65e92e4ee..91a43a37ad07e0488199118d24b0517330c5697c 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -189,7 +189,7 @@ void TimelineEvent::Reset() {
void TimelineEvent::AsyncBegin(const char* label, int64_t async_id) {
Init(kAsyncBegin, label);
- timestamp0_ = OS::GetCurrentTraceMicros();
+ timestamp0_ = OS::GetCurrentMonotonicMicros();
// Overload timestamp1_ with the async_id.
timestamp1_ = async_id;
}
@@ -198,7 +198,7 @@ void TimelineEvent::AsyncBegin(const char* label, int64_t async_id) {
void TimelineEvent::AsyncInstant(const char* label,
int64_t async_id) {
Init(kAsyncInstant, label);
- timestamp0_ = OS::GetCurrentTraceMicros();
+ timestamp0_ = OS::GetCurrentMonotonicMicros();
// Overload timestamp1_ with the async_id.
timestamp1_ = async_id;
}
@@ -207,7 +207,7 @@ void TimelineEvent::AsyncInstant(const char* label,
void TimelineEvent::AsyncEnd(const char* label,
int64_t async_id) {
Init(kAsyncEnd, label);
- timestamp0_ = OS::GetCurrentTraceMicros();
+ timestamp0_ = OS::GetCurrentMonotonicMicros();
// Overload timestamp1_ with the async_id.
timestamp1_ = async_id;
}
@@ -215,18 +215,18 @@ void TimelineEvent::AsyncEnd(const char* label,
void TimelineEvent::DurationBegin(const char* label) {
Init(kDuration, label);
- timestamp0_ = OS::GetCurrentTraceMicros();
+ timestamp0_ = OS::GetCurrentMonotonicMicros();
}
void TimelineEvent::DurationEnd() {
- timestamp1_ = OS::GetCurrentTraceMicros();
+ timestamp1_ = OS::GetCurrentMonotonicMicros();
}
void TimelineEvent::Instant(const char* label) {
Init(kInstant, label);
- timestamp0_ = OS::GetCurrentTraceMicros();
+ timestamp0_ = OS::GetCurrentMonotonicMicros();
}
@@ -453,7 +453,7 @@ int64_t TimelineEvent::AsyncId() const {
int64_t TimelineEvent::TimeDuration() const {
if (timestamp1_ == 0) {
// This duration is still open, use current time as end.
- return OS::GetCurrentTraceMicros() - timestamp0_;
+ return OS::GetCurrentMonotonicMicros() - timestamp0_;
}
return timestamp1_ - timestamp0_;
}
@@ -529,7 +529,7 @@ TimelineDurationScope::~TimelineDurationScope() {
return;
}
ASSERT(event != NULL);
- event->Duration(label_, timestamp_, OS::GetCurrentTraceMicros());
+ event->Duration(label_, timestamp_, OS::GetCurrentMonotonicMicros());
event->StealArguments(arguments_length_, arguments_);
event->Complete();
arguments_length_ = 0;
@@ -545,7 +545,7 @@ void TimelineDurationScope::Init() {
// Stream is not enabled, do nothing.
return;
}
- timestamp_ = OS::GetCurrentTraceMicros();
+ timestamp_ = OS::GetCurrentMonotonicMicros();
enabled_ = true;
}
« no previous file with comments | « runtime/vm/timeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698