Cleanup timeline markers. (flutter/engine#3540)
* Name the platform thread in the timeline. This does not affect (nor is it affected by) the pthread name set by the embedder. * Make it easier in the timeline to see not only when the frame was request, but also when that frame request was fulfilled. * Trace message loop wakes.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "flutter/fml/trace_event.h"
|
||||
#include "lib/ftl/build_config.h"
|
||||
|
||||
#if OS_MACOSX
|
||||
@@ -111,6 +112,7 @@ ftl::TimePoint MessageLoopImpl::RegisterTaskAndGetNextWake(
|
||||
}
|
||||
|
||||
ftl::TimePoint MessageLoopImpl::RunExpiredTasksAndGetNextWake() {
|
||||
TRACE_EVENT0("fml", "MessageLoop::RunExpiredTasks");
|
||||
std::vector<ftl::Closure> invocations;
|
||||
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ Animator::Animator(ftl::WeakPtr<Rasterizer> rasterizer,
|
||||
engine_(engine),
|
||||
layer_tree_pipeline_(ftl::MakeRefCounted<LayerTreePipeline>(3)),
|
||||
pending_frame_semaphore_(1),
|
||||
frame_number_(1),
|
||||
paused_(false),
|
||||
weak_factory_(this) {}
|
||||
|
||||
@@ -37,6 +38,8 @@ void Animator::Start() {
|
||||
}
|
||||
|
||||
void Animator::BeginFrame(ftl::TimePoint frame_time) {
|
||||
TRACE_EVENT_ASYNC_END0("flutter", "Frame Request Pending", frame_number_++);
|
||||
|
||||
pending_frame_semaphore_.Signal();
|
||||
|
||||
if (!producer_continuation_) {
|
||||
@@ -101,12 +104,15 @@ void Animator::RequestFrame() {
|
||||
// started an expensive operation right after posting this message however.
|
||||
// To support that, we need edge triggered wakes on VSync.
|
||||
|
||||
blink::Threads::UI()->PostTask([self = weak_factory_.GetWeakPtr()]() {
|
||||
if (!self.get())
|
||||
return;
|
||||
TRACE_EVENT_INSTANT0("flutter", "RequestFrame");
|
||||
self->AwaitVSync();
|
||||
});
|
||||
blink::Threads::UI()->PostTask(
|
||||
[ self = weak_factory_.GetWeakPtr(), frame_number = frame_number_ ]() {
|
||||
if (!self.get()) {
|
||||
return;
|
||||
}
|
||||
TRACE_EVENT_ASYNC_BEGIN0("flutter", "Frame Request Pending",
|
||||
frame_number);
|
||||
self->AwaitVSync();
|
||||
});
|
||||
}
|
||||
|
||||
void Animator::AwaitVSync() {
|
||||
|
||||
@@ -47,6 +47,7 @@ class Animator {
|
||||
ftl::RefPtr<LayerTreePipeline> layer_tree_pipeline_;
|
||||
flutter::Semaphore pending_frame_semaphore_;
|
||||
LayerTreePipeline::ProducerContinuation producer_continuation_;
|
||||
int64_t frame_number_;
|
||||
bool paused_;
|
||||
|
||||
ftl::WeakPtrFactory<Animator> weak_factory_;
|
||||
|
||||
@@ -30,6 +30,8 @@ static void AddTraceMetadata() {
|
||||
blink::Threads::Gpu()->PostTask([]() { Dart_SetThreadName("gpu_thread"); });
|
||||
blink::Threads::UI()->PostTask([]() { Dart_SetThreadName("ui_thread"); });
|
||||
blink::Threads::IO()->PostTask([]() { Dart_SetThreadName("io_thread"); });
|
||||
blink::Threads::Platform()->PostTask(
|
||||
[]() { Dart_SetThreadName("platform_thread"); });
|
||||
}
|
||||
|
||||
void TracingController::StartTracing() {
|
||||
|
||||
Reference in New Issue
Block a user