Chromium Code Reviews| Index: runtime/vm/timeline.h |
| diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h |
| index 3c771292d58c720dd5bb901a783caf92a6073c57..e1e350adaff90d3e4215ccc22137b28c232e1580 100644 |
| --- a/runtime/vm/timeline.h |
| +++ b/runtime/vm/timeline.h |
| @@ -22,6 +22,13 @@ class TimelineEventBlock; |
| class TimelineEventRecorder; |
| class TimelineStream; |
| +// (name, enabled by default). |
|
rmacnak
2015/09/21 21:12:35
name, locally enabled by default
Cutch
2015/09/21 21:19:54
I've replaced all names of the second macro argume
|
| +#define ISOLATE_TIMELINE_STREAM_LIST(V) \ |
| + V(API, false) \ |
| + V(Compiler, false) \ |
| + V(Embedder, false) \ |
| + V(GC, false) \ |
| + V(Isolate, false) \ |
| class Timeline : public AllStatic { |
| public: |
| @@ -38,10 +45,25 @@ class Timeline : public AllStatic { |
| static TimelineStream* GetVMStream(); |
| +#define ISOLATE_TIMELINE_STREAM_FLAGS(name, enabled_by_default) \ |
| + static const bool* Stream##name##EnabledFlag() { \ |
| + return &stream_##name##_enabled_; \ |
| + } \ |
| + static void SetStream##name##Enabled(bool enabled) { \ |
| + stream_##name##_enabled_ = enabled; \ |
| + } |
| + ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_FLAGS) |
| +#undef ISOLATE_TIMELINE_STREAM_FLAGS |
| + |
| private: |
| static TimelineEventRecorder* recorder_; |
| static TimelineStream* vm_stream_; |
| +#define ISOLATE_TIMELINE_STREAM_DECLARE_FLAG(name, enabled_by_default) \ |
| + static bool stream_##name##_enabled_; |
| + ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_DECLARE_FLAG) |
| +#undef ISOLATE_TIMELINE_STREAM_DECLARE_FLAG |
| + |
| friend class TimelineRecorderOverride; |
| }; |
| @@ -190,17 +212,24 @@ class TimelineEvent { |
| // A stream of timeline events. A stream has a name and can be enabled or |
| -// disabled. |
| +// disabled (globally and per isolate). |
| class TimelineStream { |
| public: |
| TimelineStream(); |
| - void Init(const char* name, bool enabled); |
| + void Init(const char* name, |
| + bool enabled, |
| + const bool* globally_enabled = NULL); |
| const char* name() const { |
| return name_; |
| } |
| + bool Enabled() const { |
| + return ((globally_enabled_ != NULL) && *globally_enabled_) || |
| + enabled(); |
| + } |
| + |
| bool enabled() const { |
| return enabled_; |
| } |
| @@ -216,18 +245,9 @@ class TimelineStream { |
| private: |
| const char* name_; |
| bool enabled_; |
| + const bool* globally_enabled_; |
| }; |
| - |
| -// (name, enabled by default). |
| -#define ISOLATE_TIMELINE_STREAM_LIST(V) \ |
| - V(API, false) \ |
| - V(Compiler, false) \ |
| - V(Embedder, false) \ |
| - V(GC, false) \ |
| - V(Isolate, false) \ |
| - |
| - |
| #define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, suffix, function) \ |
| TimelineDurationScope tds(thread, \ |
| thread->isolate()->GetCompilerStream(), \ |