Skip to content

Commit

Permalink
add log flutter#6137
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy committed Oct 10, 2022
1 parent 0dab1f1 commit a508aa5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
31 changes: 21 additions & 10 deletions shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static fml::TimePoint FxlToDartOrEarlier(fml::TimePoint time) {

void Animator::BeginFrame(
std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder) {
FML_DLOG(INFO) << "hi Animator::BeginFrame start";
FML_DLOG(ERROR) << "hi Animator::BeginFrame start";

// // test logs
// FML_DLOG(INFO) << "hi this is FML_DLOG(INFO)";
Expand Down Expand Up @@ -169,7 +169,7 @@ void Animator::BeginFrame(

void Animator::Render(std::shared_ptr<flutter::LayerTree> layer_tree,
fml::TimePoint fallback_vsync_target_time) {
FML_DLOG(INFO) << "hi Animator::Render start";
FML_DLOG(ERROR) << "hi Animator::Render start";

has_rendered_ = true;
last_layer_tree_size_ = layer_tree->frame_size();
Expand All @@ -179,15 +179,26 @@ void Animator::Render(std::shared_ptr<flutter::LayerTree> layer_tree,
frame_timings_recorder_ = std::make_unique<FrameTimingsRecorder>();

// NOTE MODIFIED
// "<0" means not provided
const fml::TimePoint placeholder_time =
fallback_vsync_target_time.ToEpochDelta().ToMicroseconds() < 0
? fml::TimePoint::Now()
: fallback_vsync_target_time;
// const fml::TimePoint placeholder_time = fml::TimePoint::Now();

frame_timings_recorder_->RecordVsync(placeholder_time, placeholder_time);
const fml::TimePoint now = fml::TimePoint::Now();
const fml::TimePoint placeholder_time = now;
const fml::TimePoint vsync_target_time =
std::max(fallback_vsync_target_time, now);
frame_timings_recorder_->RecordVsync(placeholder_time, vsync_target_time);
frame_timings_recorder_->RecordBuildStart(placeholder_time);

// const fml::TimePoint placeholder_time = fml::TimePoint::Now();
// frame_timings_recorder_->RecordVsync(placeholder_time,
// placeholder_time);
// frame_timings_recorder_->RecordBuildStart(placeholder_time);

FML_DLOG(ERROR)
<< "populate frame_timings_recorder_ "
<< " fallback_vsync_target_time="
<< fallback_vsync_target_time.ToEpochDelta().ToMicroseconds()
<< " placeholder_time="
<< placeholder_time.ToEpochDelta().ToMicroseconds()
<< " vsync_target_time="
<< vsync_target_time.ToEpochDelta().ToMicroseconds();
}

TRACE_EVENT_WITH_FRAME_NUMBER(frame_timings_recorder_, "flutter",
Expand Down
7 changes: 7 additions & 0 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ RasterStatus Rasterizer::DoDraw(
const auto frame_lag =
(latest_frame_target_time - frame_target_time).ToMillisecondsF();
const int vsync_transitions_missed = round(frame_lag / frame_budget_millis);
FML_DLOG(ERROR) << "hi Rasterizer::DoDraw calc SceneDisplayLag"
<< " raster_finish_time="
<< raster_finish_time.ToEpochDelta().ToMicroseconds()
<< " latest_frame_target_time="
<< latest_frame_target_time.ToEpochDelta().ToMicroseconds()
<< " frame_target_time="
<< frame_target_time.ToEpochDelta().ToMicroseconds();
fml::tracing::TraceEventAsyncComplete(
"flutter", // category
"SceneDisplayLag", // name
Expand Down

0 comments on commit a508aa5

Please sign in to comment.