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

Side by Side Diff: src/tracing/tracing-category-observer.cc

Issue 2460973003: [Tracing] Use TracingCategoryObserver in runtime statistics (Closed)
Patch Set: address cbruni's comments Created 4 years, 1 month 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
« src/log.cc ('K') | « src/tracing/trace-event.cc ('k') | 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 "src/tracing/tracing-category-observer.h" 5 #include "src/tracing/tracing-category-observer.h"
6 6
7 #include "include/v8.h" 7 #include "include/v8.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/tracing/trace-event.h" 9 #include "src/tracing/trace-event.h"
10 #include "src/v8.h" 10 #include "src/v8.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace tracing { 13 namespace tracing {
14 14
15 std::unique_ptr<TracingCategoryObserver> TracingCategoryObserver::Create() { 15 std::unique_ptr<TracingCategoryObserver> TracingCategoryObserver::Create() {
16 return std::unique_ptr<TracingCategoryObserver>( 16 return std::unique_ptr<TracingCategoryObserver>(
17 new TracingCategoryObserverImpl()); 17 new TracingCategoryObserverImpl());
18 } 18 }
19 19
20 TracingCategoryObserverImpl::TracingCategoryObserverImpl() {} 20 TracingCategoryObserverImpl::TracingCategoryObserverImpl() {
21 TRACE_EVENT_WARMUP_CATEGORY(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"));
22 }
21 23
22 TracingCategoryObserverImpl::~TracingCategoryObserverImpl() { 24 TracingCategoryObserverImpl::~TracingCategoryObserverImpl() {
23 OnTraceDisabled(); 25 OnTraceDisabled();
24 } 26 }
25 27
26 void TracingCategoryObserverImpl::OnTraceEnabled() { 28 void TracingCategoryObserverImpl::OnTraceEnabled() {
27 bool enabled = false; 29 bool enabled = false;
28 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 30 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
29 TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), &enabled); 31 TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), &enabled);
30 if (enabled) { 32 if (enabled) {
31 v8::internal::FLAG_runtime_stats |= ENABLED_BY_TRACING; 33 v8::internal::FLAG_runtime_stats |= ENABLED_BY_TRACING;
32 } 34 }
33 } 35 }
34 36
35 void TracingCategoryObserverImpl::OnTraceDisabled() { 37 void TracingCategoryObserverImpl::OnTraceDisabled() {
36 v8::internal::FLAG_runtime_stats &= ~ENABLED_BY_TRACING; 38 v8::internal::FLAG_runtime_stats ^= ENABLED_BY_TRACING;
alph 2016/10/31 20:46:53 This won't work. The category might not have been
lpy 2016/10/31 20:54:19 Done. ah you are right, I think the original one
37 } 39 }
38 40
39 } // namespace tracing 41 } // namespace tracing
40 } // namespace v8 42 } // namespace v8
OLDNEW
« src/log.cc ('K') | « src/tracing/trace-event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698