Skip to content

Commit

Permalink
remove TracePseudoVsync flutter#6197
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy committed Oct 15, 2022
1 parent 031bffd commit 04989e8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
63 changes: 32 additions & 31 deletions shell/common/vsync_waiter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,22 @@ void VsyncWaiter::ScheduleSecondaryCallback(uintptr_t id,
AwaitVSyncForSecondaryCallback();
}

void TracePseudoVsync(fml::TimePoint start, fml::TimePoint end) {
// not working
// https://github.com/fzyzcjy/yplusplus/issues/6049#issuecomment-1270892321
// fml::tracing::TraceEventAsyncComplete("flutter", "VSYNC",
// frame_start_time,
// frame_target_time);

// ref [TraceEvent0]
fml::tracing::TraceTimelineEvent("flutter", "VSYNC",
start.ToEpochDelta().ToMicroseconds(), 0,
Dart_Timeline_Event_Begin, {}, {});
// ref [TraceEventEnd]
fml::tracing::TraceTimelineEvent("flutter", "VSYNC",
end.ToEpochDelta().ToMicroseconds(), 0,
Dart_Timeline_Event_End, {}, {});
}
// void TracePseudoVsync(fml::TimePoint start, fml::TimePoint end) {
// // not working
// // https://github.com/fzyzcjy/yplusplus/issues/6049#issuecomment-1270892321
// // fml::tracing::TraceEventAsyncComplete("flutter", "VSYNC",
// // frame_start_time,
// // frame_target_time);
//
// // ref [TraceEvent0]
// fml::tracing::TraceTimelineEvent("flutter", "VSYNC",
// start.ToEpochDelta().ToMicroseconds(), 0,
// Dart_Timeline_Event_Begin, {}, {});
// // ref [TraceEventEnd]
// fml::tracing::TraceTimelineEvent("flutter", "VSYNC",
// end.ToEpochDelta().ToMicroseconds(), 0,
// Dart_Timeline_Event_End, {}, {});
// }

void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time,
fml::TimePoint frame_target_time,
Expand Down Expand Up @@ -232,21 +232,22 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time,
// #6197
fml::TimeDelta::FromMilliseconds(3));

// for debug #5988
// use the name "VSYNC" since #6049
TracePseudoVsync(frame_start_time, frame_target_time);
if (last_timeline_report_vsync_target_time_.has_value()) {
fml::TimeDelta rough_frame_duration = frame_target_time - frame_start_time;
for (fml::TimePoint t = frame_target_time - rough_frame_duration;
t > last_timeline_report_vsync_target_time_.value() +
fml::TimeDelta::FromMilliseconds(1);
t = t - rough_frame_duration) {
TracePseudoVsync(t - rough_frame_duration,
// -1us to avoid multi events be treated as one (?)
t - fml::TimeDelta::FromMicroseconds(1));
}
}
last_timeline_report_vsync_target_time_ = frame_target_time;
// // for debug #5988
// // use the name "VSYNC" since #6049
// TracePseudoVsync(frame_start_time, frame_target_time);
// if (last_timeline_report_vsync_target_time_.has_value()) {
// fml::TimeDelta rough_frame_duration = frame_target_time -
// frame_start_time; for (fml::TimePoint t = frame_target_time -
// rough_frame_duration;
// t > last_timeline_report_vsync_target_time_.value() +
// fml::TimeDelta::FromMilliseconds(1);
// t = t - rough_frame_duration) {
// TracePseudoVsync(t - rough_frame_duration,
// // -1us to avoid multi events be treated as one (?)
// t - fml::TimeDelta::FromMicroseconds(1));
// }
// }
// last_timeline_report_vsync_target_time_ = frame_target_time;

if (callback) {
auto flow_identifier = fml::tracing::TraceNonce();
Expand Down
2 changes: 1 addition & 1 deletion shell/common/vsync_waiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class VsyncWaiter : public std::enable_shared_from_this<VsyncWaiter> {
std::mutex callback_mutex_;
Callback callback_;
std::unordered_map<uintptr_t, fml::closure> secondary_callbacks_;
std::optional<fml::TimePoint> last_timeline_report_vsync_target_time_{};
// std::optional<fml::TimePoint> last_timeline_report_vsync_target_time_{};

void PauseDartMicroTasks();
static void ResumeDartMicroTasks(fml::TaskQueueId ui_task_queue_id);
Expand Down

0 comments on commit 04989e8

Please sign in to comment.