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

Side by Side Diff: runtime/vm/profiler_service.cc

Issue 1826743002: Function profile should respect --show-invisible-frames (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « runtime/vm/profiler_service.h ('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 (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 "vm/profiler_service.h" 5 #include "vm/profiler_service.h"
6 6
7 #include "vm/growable_array.h" 7 #include "vm/growable_array.h"
8 #include "vm/log.h" 8 #include "vm/log.h"
9 #include "vm/native_symbol.h" 9 #include "vm/native_symbol.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/os.h" 11 #include "vm/os.h"
12 #include "vm/profiler.h" 12 #include "vm/profiler.h"
13 #include "vm/reusable_handles.h" 13 #include "vm/reusable_handles.h"
14 #include "vm/scope_timer.h" 14 #include "vm/scope_timer.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 DECLARE_FLAG(int, max_profile_depth); 18 DECLARE_FLAG(int, max_profile_depth);
19 DECLARE_FLAG(int, profile_period); 19 DECLARE_FLAG(int, profile_period);
20 DECLARE_FLAG(bool, show_invisible_frames);
20 21
21 DEFINE_FLAG(bool, trace_profiler, false, "Trace profiler."); 22 DEFINE_FLAG(bool, trace_profiler, false, "Trace profiler.");
22 23
23 #ifndef PRODUCT 24 #ifndef PRODUCT
24 25
25 class DeoptimizedCodeSet : public ZoneAllocated { 26 class DeoptimizedCodeSet : public ZoneAllocated {
26 public: 27 public:
27 explicit DeoptimizedCodeSet(Isolate* isolate) 28 explicit DeoptimizedCodeSet(Isolate* isolate)
28 : previous_( 29 : previous_(
29 GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())), 30 GrowableObjectArray::ZoneHandle(isolate->deoptimized_code_array())),
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (name_ != NULL) { 131 if (name_ != NULL) {
131 return name_; 132 return name_;
132 } 133 }
133 ASSERT(!function_.IsNull()); 134 ASSERT(!function_.IsNull());
134 const String& func_name = 135 const String& func_name =
135 String::Handle(function_.QualifiedUserVisibleName()); 136 String::Handle(function_.QualifiedUserVisibleName());
136 return func_name.ToCString(); 137 return func_name.ToCString();
137 } 138 }
138 139
139 140
141 bool ProfileFunction::is_visible() const {
142 if (function_.IsNull()) {
143 // Some synthetic function.
144 return true;
145 }
146 return FLAG_show_invisible_frames || function_.is_visible();
147 }
148
149
140 void ProfileFunction::Tick(bool exclusive, 150 void ProfileFunction::Tick(bool exclusive,
141 intptr_t inclusive_serial, 151 intptr_t inclusive_serial,
142 TokenPosition token_position) { 152 TokenPosition token_position) {
143 if (exclusive) { 153 if (exclusive) {
144 exclusive_ticks_++; 154 exclusive_ticks_++;
145 TickSourcePosition(token_position, exclusive); 155 TickSourcePosition(token_position, exclusive);
146 } 156 }
147 // Fall through and tick inclusive count too. 157 // Fall through and tick inclusive count too.
148 if (inclusive_serial_ == inclusive_serial) { 158 if (inclusive_serial_ == inclusive_serial) {
149 // Already ticked. 159 // Already ticked.
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 return IsExecutingFrame(sample, frame_index) || vm_tags_emitted(); 1618 return IsExecutingFrame(sample, frame_index) || vm_tags_emitted();
1609 } 1619 }
1610 1620
1611 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current, 1621 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current,
1612 intptr_t sample_index, 1622 intptr_t sample_index,
1613 ProcessedSample* sample, 1623 ProcessedSample* sample,
1614 intptr_t frame_index, 1624 intptr_t frame_index,
1615 ProfileFunction* function, 1625 ProfileFunction* function,
1616 TokenPosition token_position, 1626 TokenPosition token_position,
1617 intptr_t code_index) { 1627 intptr_t code_index) {
1628 if (!function->is_visible()) {
1629 return current;
1630 }
1618 if (tick_functions_) { 1631 if (tick_functions_) {
1619 if (FLAG_trace_profiler) { 1632 if (FLAG_trace_profiler) {
1620 THR_Print("S[%" Pd "]F[%" Pd "] %s %s 0x%" Px "\n", 1633 THR_Print("S[%" Pd "]F[%" Pd "] %s %s 0x%" Px "\n",
1621 sample_index, 1634 sample_index,
1622 frame_index, 1635 frame_index,
1623 function->Name(), 1636 function->Name(),
1624 token_position.ToCString(), 1637 token_position.ToCString(),
1625 sample->At(frame_index)); 1638 sample->At(frame_index));
1626 } 1639 }
1627 function->Tick(IsExecutingFrame(sample, frame_index), 1640 function->Tick(IsExecutingFrame(sample, frame_index),
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 // Disable thread interrupts while processing the buffer. 2614 // Disable thread interrupts while processing the buffer.
2602 DisableThreadInterruptsScope dtis(thread); 2615 DisableThreadInterruptsScope dtis(thread);
2603 2616
2604 ClearProfileVisitor clear_profile(isolate); 2617 ClearProfileVisitor clear_profile(isolate);
2605 sample_buffer->VisitSamples(&clear_profile); 2618 sample_buffer->VisitSamples(&clear_profile);
2606 } 2619 }
2607 2620
2608 #endif // !PRODUCT 2621 #endif // !PRODUCT
2609 2622
2610 } // namespace dart 2623 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698