diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc index 2ef7b813fe8..1cb56ce0ae4 100644 --- a/runtime/vm/profiler_service.cc +++ b/runtime/vm/profiler_service.cc @@ -18,6 +18,7 @@ namespace dart { DECLARE_FLAG(int, max_profile_depth); DECLARE_FLAG(int, profile_period); +DECLARE_FLAG(bool, show_invisible_frames); #ifndef PRODUCT @@ -136,6 +137,15 @@ const char* ProfileFunction::Name() const { } +bool ProfileFunction::is_visible() const { + if (function_.IsNull()) { + // Some synthetic function. + return true; + } + return FLAG_show_invisible_frames || function_.is_visible(); +} + + void ProfileFunction::Tick(bool exclusive, intptr_t inclusive_serial, TokenPosition token_position) { @@ -1624,6 +1634,9 @@ class ProfileBuilder : public ValueObject { ProfileFunction* function, TokenPosition token_position, intptr_t code_index) { + if (!function->is_visible()) { + return current; + } if (tick_functions_) { if (FLAG_trace_profiler_verbose) { THR_Print("S[%" Pd "]F[%" Pd "] %s %s 0x%" Px "\n", diff --git a/runtime/vm/profiler_service.h b/runtime/vm/profiler_service.h index 7280b15fd22..0e0e6d3bcce 100644 --- a/runtime/vm/profiler_service.h +++ b/runtime/vm/profiler_service.h @@ -77,6 +77,8 @@ class ProfileFunction : public ZoneAllocated { return &function_; } + bool is_visible() const; + intptr_t table_index() const { return table_index_; }