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

Unified Diff: runtime/vm/timeline.h

Issue 1362503002: Add global timeline stream overrides (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/timeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline.h
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index 3c771292d58c720dd5bb901a783caf92a6073c57..335ff14b9ac246ae6094cb0e9c818c8eaf314053 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 for isolate).
+#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, not_used) \
+ 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, not_used) \
+ 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(), \
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698