Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@yuanhuihui
Copy link
Contributor

If we set FLAG_startup_timeline, using TimelineEventStartupRecorder.
If we set FLAG_systrace_timeline, using TimelineEventSystraceRecorder.
If set use_endless_recorder, using TimelineEventEndlessRecorder.

in file third_party/dart/runtime/vm/timeline.cc

static TimelineEventRecorder* CreateTimelineRecorder() {
  const bool use_endless_recorder =
      (FLAG_timeline_dir != NULL) || FLAG_timing || FLAG_complete_timeline;

  const bool use_startup_recorder = FLAG_startup_timeline;
  const bool use_systrace_recorder = FLAG_systrace_timeline;
  const char* flag = FLAG_timeline_recorder;

  if (use_systrace_recorder || (flag != NULL)) {
    if (use_systrace_recorder || (strcmp("systrace", flag) == 0)) {
#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
      return new TimelineEventSystraceRecorder();
#elif defined(HOST_OS_FUCHSIA)
      return new TimelineEventFuchsiaRecorder();
#else
      OS::PrintErr(
          "Warning: The systrace timeline recorder is equivalent to the"
          "ring recorder on this platform.");
      return new TimelineEventRingRecorder();
#endif
    }
  }

  if (use_endless_recorder || (flag != NULL)) {
    if (use_endless_recorder || (strcmp("endless", flag) == 0)) {
      return new TimelineEventEndlessRecorder();
    }
  }

  if (use_startup_recorder || (flag != NULL)) {
    if (use_startup_recorder || (strcmp("startup", flag) == 0)) {
      return new TimelineEventStartupRecorder();
    }
  }
  return new TimelineEventRingRecorder();
}

So we set trace_startup should be equivalent to FLAG_startup_timeline, instead of using endless recorder. If needed, we can combine two parameters, such as: flutter run --trace-startup --endless-trace-buffer. That will use startup‘s streams and endless buffer.

@yuanhuihui yuanhuihui changed the title fix timeline recorder startup flags use startup recorder Feb 12, 2020
@chinmaygarde
Copy link
Member

Unfortunately, this changes existing behavior. If the startup flag is not combined with the endless trace flag, the startup traces are almost always lost which is not what we want.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants