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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <cstdlib> 5 #include <cstdlib>
6 6
7 #include "vm/atomic.h" 7 #include "vm/atomic.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/json_stream.h" 9 #include "vm/json_stream.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 arguments_ = NULL; 880 arguments_ = NULL;
881 } 881 }
882 882
883 883
884 TimelineDurationScope::TimelineDurationScope(TimelineStream* stream, 884 TimelineDurationScope::TimelineDurationScope(TimelineStream* stream,
885 const char* label) 885 const char* label)
886 : TimelineEventScope(stream, label) { 886 : TimelineEventScope(stream, label) {
887 if (!FLAG_support_timeline) { 887 if (!FLAG_support_timeline) {
888 return; 888 return;
889 } 889 }
890 timestamp_ = OS::GetCurrentMonotonicMicros(); 890 if (enabled()) {
891 thread_timestamp_ = OS::GetCurrentThreadCPUMicros(); 891 timestamp_ = OS::GetCurrentMonotonicMicros();
892 thread_timestamp_ = OS::GetCurrentThreadCPUMicros();
893 }
892 } 894 }
893 895
894 896
895 TimelineDurationScope::TimelineDurationScope(Thread* thread, 897 TimelineDurationScope::TimelineDurationScope(Thread* thread,
896 TimelineStream* stream, 898 TimelineStream* stream,
897 const char* label) 899 const char* label)
898 : TimelineEventScope(thread, stream, label) { 900 : TimelineEventScope(thread, stream, label) {
899 if (!FLAG_support_timeline) { 901 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.
900 return; 902 return;
901 } 903 }
902 timestamp_ = OS::GetCurrentMonotonicMicros(); 904 if (enabled()) {
903 thread_timestamp_ = OS::GetCurrentThreadCPUMicros(); 905 timestamp_ = OS::GetCurrentMonotonicMicros();
906 thread_timestamp_ = OS::GetCurrentThreadCPUMicros();
907 }
904 } 908 }
905 909
906 910
907 TimelineDurationScope::~TimelineDurationScope() { 911 TimelineDurationScope::~TimelineDurationScope() {
908 if (!FLAG_support_timeline) { 912 if (!FLAG_support_timeline) {
909 return; 913 return;
910 } 914 }
911 if (!ShouldEmitEvent()) { 915 if (!ShouldEmitEvent()) {
912 return; 916 return;
913 } 917 }
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 TimelineEventBlock* TimelineEventBlockIterator::Next() { 1698 TimelineEventBlock* TimelineEventBlockIterator::Next() {
1695 ASSERT(current_ != NULL); 1699 ASSERT(current_ != NULL);
1696 TimelineEventBlock* r = current_; 1700 TimelineEventBlock* r = current_;
1697 current_ = current_->next(); 1701 current_ = current_->next();
1698 return r; 1702 return r;
1699 } 1703 }
1700 1704
1701 #endif // !PRODUCT 1705 #endif // !PRODUCT
1702 1706
1703 } // namespace dart 1707 } // namespace dart
OLDNEW
« 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