| Index: runtime/vm/timeline.h
|
| diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
|
| index f6879a60b497d676ad82ff06e10e75ada3c39dba..118eb9f04027a73e040c6b4303d49ee8bf8988af 100644
|
| --- a/runtime/vm/timeline.h
|
| +++ b/runtime/vm/timeline.h
|
| @@ -38,6 +38,42 @@ class Zone;
|
| V(Isolate, false) \
|
| V(VM, false)
|
|
|
| +// A stream of timeline events. A stream has a name and can be enabled or
|
| +// disabled (globally and per isolate).
|
| +class TimelineStream {
|
| + public:
|
| + TimelineStream();
|
| +
|
| + void Init(const char* name,
|
| + bool enabled);
|
| +
|
| + const char* name() const {
|
| + return name_;
|
| + }
|
| +
|
| + bool enabled() const {
|
| + return enabled_ != 0;
|
| + }
|
| +
|
| + void set_enabled(bool enabled) {
|
| + enabled_ = enabled ? 1 : 0;
|
| + }
|
| +
|
| + // Records an event. Will return |NULL| if not enabled. The returned
|
| + // |TimelineEvent| is in an undefined state and must be initialized.
|
| + // NOTE: It is not allowed to call StartEvent again without completing
|
| + // the first event.
|
| + TimelineEvent* StartEvent();
|
| +
|
| + static intptr_t enabled_offset() {
|
| + return OFFSET_OF(TimelineStream, enabled_);
|
| + }
|
| +
|
| + private:
|
| + const char* name_;
|
| + uintptr_t enabled_;
|
| +};
|
| +
|
| class Timeline : public AllStatic {
|
| public:
|
| // Initialize timeline system. Not thread safe.
|
| @@ -57,18 +93,15 @@ class Timeline : public AllStatic {
|
| // Print information about streams to JSON.
|
| static void PrintFlagsToJSON(JSONStream* json);
|
|
|
| -#define TIMELINE_STREAM_ACCESSOR(name, not_used) \
|
| +#define TIMELINE_STREAM_ACCESSOR(name, not_used) \
|
| static TimelineStream* Get##name##Stream() { return &stream_##name##_; }
|
| TIMELINE_STREAM_LIST(TIMELINE_STREAM_ACCESSOR)
|
| #undef TIMELINE_STREAM_ACCESSOR
|
|
|
| #define TIMELINE_STREAM_FLAGS(name, not_used) \
|
| - static const bool* Stream##name##EnabledFlag() { \
|
| - return &stream_##name##_enabled_; \
|
| - } \
|
| static void SetStream##name##Enabled(bool enabled) { \
|
| - StreamStateChange(#name, stream_##name##_enabled_, enabled); \
|
| - stream_##name##_enabled_ = enabled; \
|
| + StreamStateChange(#name, stream_##name##_.enabled(), enabled); \
|
| + stream_##name##_.set_enabled(enabled); \
|
| }
|
| TIMELINE_STREAM_LIST(TIMELINE_STREAM_FLAGS)
|
| #undef TIMELINE_STREAM_FLAGS
|
| @@ -383,45 +416,6 @@ class TimelineEvent {
|
| };
|
|
|
|
|
| -// A stream of timeline events. A stream has a name and can be enabled or
|
| -// disabled (globally and per isolate).
|
| -class TimelineStream {
|
| - public:
|
| - TimelineStream();
|
| -
|
| - 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_;
|
| - }
|
| -
|
| - void set_enabled(bool enabled) {
|
| - enabled_ = enabled;
|
| - }
|
| -
|
| - // Records an event. Will return |NULL| if not enabled. The returned
|
| - // |TimelineEvent| is in an undefined state and must be initialized.
|
| - // NOTE: It is not allowed to call StartEvent again without completing
|
| - // the first event.
|
| - TimelineEvent* StartEvent();
|
| -
|
| - private:
|
| - const char* name_;
|
| - bool enabled_;
|
| - const bool* globally_enabled_;
|
| -};
|
| -
|
| #ifndef PRODUCT
|
| #define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function) \
|
| TimelineDurationScope tds(thread, \
|
|
|