这是indexloc提供的服务,不要输入任何密码
Skip to content

support endless recorder for timeline #47419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

yuanhuihui
Copy link
Contributor

Timeline use TimelineEventRingRecorder by default.
If we set trace-systrace, using TimelineEventSystraceRecorder.
If set endless-trace-buffer, we need support 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();
}

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Dec 19, 2019
@fluttergithubbot
Copy link
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@zanderso
Copy link
Member

Is this flag in the engine yet? I'll mark this as "work in progress", but feel free to unmark and add reviewers when it is ready. Thanks!

@yuanhuihui
Copy link
Contributor Author

yuanhuihui commented Dec 20, 2019

Is this flag in the engine yet? I'll mark this as "work in progress", but feel free to unmark and add reviewers when it is ready. Thanks!

Yes, this flag is already in the engine, it works now. how can I unmark "work in progress" .

The flag initialization process is as follows:

-> FutterActivityDelegate.java
-> FlutterMain.java
-> flutter_main.cc
->switches.cc
->dart_vm.cc

switches.cc 
Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
  ...
  settings.endless_trace_buffer =
      command_line.HasOption(FlagForSwitch(Switch::EndlessTraceBuffer));
}

DartVM::DartVM(...){
  ...
  if (settings_.endless_trace_buffer) {
    // If we are tracing startup, make sure the trace buffer is endless so we
    // don't lose early traces.
    PushBackAll(&args, kDartEndlessTraceBufferArgs,
                arraysize(kDartEndlessTraceBufferArgs));
  }
}

@yuanhuihui
Copy link
Contributor Author

flutter/engine#14568

@cbracken
Copy link
Member

cbracken commented Jan 6, 2020

@yjbanov I'm assuming that we'll need to update our devicelab tests to set this new flag where necessary?

Specifically relating to this bit of the engine change:
https://github.com/flutter/engine/pull/14568/files#diff-b2f207848a5623d17377178d566274a9L352-R356

@yjbanov
Copy link
Contributor

yjbanov commented Jan 6, 2020

@yjbanov I'm assuming that we'll need to update our devicelab tests to set this new flag where necessary?

I'd say very likely.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@yuanhuihui
Copy link
Contributor Author

@googlebot I fixed it

@yuanhuihui yuanhuihui force-pushed the support_endless_recorder branch 2 times, most recently from b5003bb to 849ee8b Compare January 13, 2020 08:59
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@yuanhuihui
Copy link
Contributor Author

relations to #47771

@yuanhuihui
Copy link
Contributor Author

yuanhuihui commented Jan 13, 2020

@yjbanov I'm assuming that we'll need to update our devicelab tests to set this new flag where necessary?

I'd say very likely.

yes. This PR just exposes one more parameter, no matter the engine modifies the startup logic

@yuanhuihui
Copy link
Contributor Author

@zanderso @cbracken @yjbanov could you review it?

@zanderso
Copy link
Member

@cbracken @yjbanov Not sure I understand your comments. Do you think the device lab tests should be updated as part of this PR or in the future?

@jonahwilliams
Copy link
Contributor

What is the status of this PR, are we waiting for an engine roll?

@jonahwilliams
Copy link
Contributor

@zanderso do you think this is safe to merge?

@zanderso
Copy link
Member

zanderso commented Feb 6, 2020

Yes. The flag is off by default, so I suspect no device lab tests need to be updated as part of this PR.

@fluttergithubbot fluttergithubbot merged commit b8dd6bd into flutter:master Feb 6, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants