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

Unified Diff: runtime/vm/timeline.cc

Issue 1975713003: Only call OS::GetCurrentThreadCPUMicros when a TimelineDurationScope is enabled (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | 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 54735a033f58610559c46398fb94394358fb0200..4284ff28ff87236862c0ab56fcd1173d4370b08d 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -887,8 +887,10 @@ TimelineDurationScope::TimelineDurationScope(TimelineStream* stream,
if (!FLAG_support_timeline) {
return;
}
- timestamp_ = OS::GetCurrentMonotonicMicros();
- thread_timestamp_ = OS::GetCurrentThreadCPUMicros();
+ if (enabled()) {
+ timestamp_ = OS::GetCurrentMonotonicMicros();
+ thread_timestamp_ = OS::GetCurrentThreadCPUMicros();
+ }
}
@@ -899,8 +901,10 @@ TimelineDurationScope::TimelineDurationScope(Thread* thread,
if (!FLAG_support_timeline) {
Ivan Posva 2016/05/12 18:47:46 if (!FLAG_support_timeline || !enabled()) {
Cutch 2016/05/12 20:06:22 Done.
return;
}
- timestamp_ = OS::GetCurrentMonotonicMicros();
- thread_timestamp_ = OS::GetCurrentThreadCPUMicros();
+ if (enabled()) {
+ timestamp_ = OS::GetCurrentMonotonicMicros();
+ thread_timestamp_ = OS::GetCurrentThreadCPUMicros();
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698