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

Side by Side Diff: src/tracing/trace-event.cc

Issue 2342643004: [Tracing] Remove unnecessary memory allocation in runtime call stats. (Closed)
Patch Set: rebase Created 4 years, 3 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 | « src/counters.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/trace-event.h" 5 #include "src/tracing/trace-event.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 10 matching lines...) Expand all
21 v8::Platform* TraceEventHelper::GetCurrentPlatform() { 21 v8::Platform* TraceEventHelper::GetCurrentPlatform() {
22 return v8::internal::V8::GetCurrentPlatform(); 22 return v8::internal::V8::GetCurrentPlatform();
23 } 23 }
24 24
25 void CallStatsScopedTracer::AddEndTraceEvent() { 25 void CallStatsScopedTracer::AddEndTraceEvent() {
26 if (!has_parent_scope_ && p_data_->isolate) { 26 if (!has_parent_scope_ && p_data_->isolate) {
27 v8::internal::tracing::AddTraceEvent( 27 v8::internal::tracing::AddTraceEvent(
28 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, 28 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name,
29 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, 29 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId,
30 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE, 30 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE,
31 "runtime-call-stats", 31 "runtime-call-stats", TRACE_STR_COPY(p_data_->isolate->counters()
32 TRACE_STR_COPY( 32 ->runtime_call_stats()
33 p_data_->isolate->counters()->runtime_call_stats()->Dump())); 33 ->Dump()
34 .c_str()));
34 } else { 35 } else {
35 v8::internal::tracing::AddTraceEvent( 36 v8::internal::tracing::AddTraceEvent(
36 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name, 37 TRACE_EVENT_PHASE_END, p_data_->category_group_enabled, p_data_->name,
37 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, 38 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId,
38 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE); 39 v8::internal::tracing::kNoId, TRACE_EVENT_FLAG_NONE);
39 } 40 }
40 } 41 }
41 42
42 void CallStatsScopedTracer::Initialize(v8::internal::Isolate* isolate, 43 void CallStatsScopedTracer::Initialize(v8::internal::Isolate* isolate,
43 const uint8_t* category_group_enabled, 44 const uint8_t* category_group_enabled,
44 const char* name) { 45 const char* name) {
45 data_.isolate = isolate; 46 data_.isolate = isolate;
46 data_.category_group_enabled = category_group_enabled; 47 data_.category_group_enabled = category_group_enabled;
47 data_.name = name; 48 data_.name = name;
48 p_data_ = &data_; 49 p_data_ = &data_;
49 RuntimeCallStats* table = isolate->counters()->runtime_call_stats(); 50 RuntimeCallStats* table = isolate->counters()->runtime_call_stats();
50 has_parent_scope_ = table->InUse(); 51 has_parent_scope_ = table->InUse();
51 if (!has_parent_scope_) table->Reset(); 52 if (!has_parent_scope_) table->Reset();
52 v8::internal::tracing::AddTraceEvent( 53 v8::internal::tracing::AddTraceEvent(
53 TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name, 54 TRACE_EVENT_PHASE_BEGIN, category_group_enabled, name,
54 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId, 55 v8::internal::tracing::kGlobalScope, v8::internal::tracing::kNoId,
55 TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId); 56 TRACE_EVENT_FLAG_NONE, v8::internal::tracing::kNoId);
56 } 57 }
57 58
58 } // namespace tracing 59 } // namespace tracing
59 } // namespace internal 60 } // namespace internal
60 } // namespace v8 61 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698