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

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Apr 20, 2022

Removes a number of tracing events that are redundant.

Removes all "mode", "basic" tracing information, which is related to flutter/flutter#101382.

Removes the one instance of using tracing from FML, which should make it easier to detangle FML from the Dart VM and resolve issues like flutter/flutter#101866

/cc @arbreng - can you help verify that Fuchsia does not depend on these events for performance tracing?
/cc @kenzieschmoll FYI
/cc @zanderso fyi

I think this makes more sense to request a test exemption for (deleting code) rather than trying to write tests that assert we don't add these back. I anticipate this will make small positive differences in benchmarks upstream.

@flutter-dashboard
Copy link

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 on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

}

void Engine::BeginFrame(fml::TimePoint frame_time, uint64_t frame_number) {
TRACE_EVENT0("flutter", "Engine::BeginFrame");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comments to these deletions to explain why they are okay? Just looking at the PR it's hard for me to know if this is acceptable or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

This one is redundant with Animator::BeginFrame. It adds no additional information and never really shows anything valuable.

picture_metrics_ = {};
layer_metrics_ = {};
{
TRACE_EVENT0("flutter", "RasterCache::SweepCaches");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is almost always very fast and I've never used it in tracing. @flar can you comment on whehter you think this is worth keeping?

}

void MessageLoopImpl::FlushTasks(FlushType type) {
TRACE_EVENT0("fml", "MessageLoop::FlushTasks");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is FML's only direct usage of tracing, and there is always at least one interesting event beneath it. Maybe we could guard this behind a flag, but it would be good to get rid of FML's reliance on the Dart VM here and instead have more descriptive events.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

total_count.c_str());
#else
TRACE_EVENT0("flutter", "VolatilePathTracker::OnFrame");
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a separate benchmark for the volatility tracker. This information was useful to me when first implementing, but I have never used it since and it's a pretty obscure implementation detail to be surfacing in the traces.

Same comment below.

if (auto* platform_configuration = GetPlatformConfigurationIfAvailable()) {
TRACE_EVENT1("flutter", "RuntimeController::DispatchPlatformMessage",
"mode", "basic");
TRACE_EVENT0("flutter", "RuntimeController::DispatchPlatformMessage");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode: basic is no longer used.

if (auto* platform_configuration = GetPlatformConfigurationIfAvailable()) {
TRACE_EVENT1("flutter", "RuntimeController::DispatchPointerDataPacket",
"mode", "basic");
TRACE_EVENT0("flutter", "RuntimeController::DispatchPointerDataPacket");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode: basic no longer used.

Comment on lines -125 to -126
TRACE_EVENT2("flutter", "Framework Workload", "mode", "basic", "frame",
FrameParity());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and FrameParity) were used by a no longer functioning view in the observatory. See https://github.com/dart-lang/sdk/blob/main/runtime/observatory_2/web/timeline.js#L158 and related lines in there, which also refer to now-deleted timeline events.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is redundant with Animator::BeginFrame, which has the frame number in it and is easily detected as even or odd.

}

{
TRACE_EVENT0("flutter", "PipelineConsume");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated with GPURasterizer::Draw

RasterStatus Rasterizer::DrawToSurface(
FrameTimingsRecorder& frame_timings_recorder,
flutter::LayerTree& layer_tree) {
TRACE_EVENT0("flutter", "Rasterizer::DrawToSurface");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPURasterizer::Draw covers this more fully.

RasterStatus Rasterizer::DrawToSurfaceUnsafe(
FrameTimingsRecorder& frame_timings_recorder,
flutter::LayerTree& layer_tree) {
TRACE_EVENT0("flutter", "Rasterizer::DrawToSurfaceUnsafe");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPURasterizer::Draw covers this more fully.

FireNextFrameCallbackIfPresent();

if (surface_->GetContext()) {
TRACE_EVENT0("flutter", "PerformDeferredSkiaCleanup");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IME this event never shows anything interesting. We should instead just use skia tracing when needed to find out what's going on here.

@arbreng arbreng requested review from akbiggs and removed request for arbreng April 20, 2022 23:24
@arbreng
Copy link
Contributor

arbreng commented Apr 20, 2022

@akbiggs instead of me for flutter reviews moving forward :)

For this review, a grep in fuchsia's trace_processing library shows that none of the removed tags are being used, so I think you're good to go re: fuchsia

@kenzieschmoll
Copy link
Member

LGTM from DevTools perspective. The two event names we care about are "Animator::BeginFrame" and "GPURasterizer::Draw".

@akbiggs
Copy link
Contributor

akbiggs commented Apr 21, 2022

Looks good thanks Dan. I did a search of all the event names in the Fuchsia source tree and didn't find any references to them.

@dnfield dnfield requested a review from gaaclarke April 21, 2022 06:03
@dnfield dnfield merged commit 238eb9d into flutter:main Apr 21, 2022
@dnfield dnfield deleted the tracing branch April 21, 2022 20:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants