From afeae0eb697f0ad626ea08ccf31ab0d0aa18fd24 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Wed, 23 Mar 2016 15:01:21 -0700 Subject: [PATCH] Function profile should respect --show-invisible-frames This also improves the function profile by filtering out invisible frames. BUG= R=rmacnak@google.com Review URL: https://codereview.chromium.org/1826743002 . --- runtime/vm/profiler_service.cc | 13 +++++++++++++ runtime/vm/profiler_service.h | 2 ++ 2 files changed, 15 insertions(+) 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_; }