Add anchor events for developer centric timeline (flutter/engine#4105)
By adding these events the new developer centric timeline will be able to identify and correlate events related to the different stages of the drawing pipeline. Roll Dart to 62045a4590a333ae557f8f261a909ee75449cd70
This commit is contained in:
committed by
GitHub
parent
dbf765e81a
commit
0ded14f6ab
2
DEPS
2
DEPS
@@ -30,7 +30,7 @@ vars = {
|
||||
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
|
||||
# You can use //tools/dart/create_updated_flutter_deps.py to produce
|
||||
# updated revision list of existing dependencies.
|
||||
'dart_revision': 'd9a26967e0b73191b158fcdff2dc8bc303c06a1b',
|
||||
'dart_revision': '62045a4590a333ae557f8f261a909ee75449cd70',
|
||||
|
||||
'dart_args_tag': '0.13.7',
|
||||
'dart_async_tag': 'daf66909019d2aaec1721fc39d94ea648a9fdc1d',
|
||||
|
||||
@@ -88,19 +88,22 @@ void RuntimeController::NotifyIdle(int64_t deadline) {
|
||||
|
||||
void RuntimeController::DispatchPlatformMessage(
|
||||
fxl::RefPtr<PlatformMessage> message) {
|
||||
TRACE_EVENT0("flutter", "RuntimeController::DispatchPlatformMessage");
|
||||
TRACE_EVENT1("flutter", "RuntimeController::DispatchPlatformMessage", "mode",
|
||||
"basic");
|
||||
GetWindow()->DispatchPlatformMessage(std::move(message));
|
||||
}
|
||||
|
||||
void RuntimeController::DispatchPointerDataPacket(
|
||||
const PointerDataPacket& packet) {
|
||||
TRACE_EVENT0("flutter", "RuntimeController::DispatchPointerDataPacket");
|
||||
TRACE_EVENT1("flutter", "RuntimeController::DispatchPointerDataPacket",
|
||||
"mode", "basic");
|
||||
GetWindow()->DispatchPointerDataPacket(packet);
|
||||
}
|
||||
|
||||
void RuntimeController::DispatchSemanticsAction(int32_t id,
|
||||
SemanticsAction action) {
|
||||
TRACE_EVENT0("flutter", "RuntimeController::DispatchSemanticsAction");
|
||||
TRACE_EVENT1("flutter", "RuntimeController::DispatchSemanticsAction", "mode",
|
||||
"basic");
|
||||
GetWindow()->DispatchSemanticsAction(id, action);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,12 @@ void Animator::Start() {
|
||||
RequestFrame();
|
||||
}
|
||||
|
||||
// This Parity is used by the timeline component to correctly align
|
||||
// GPU Workloads events with their respective Framework Workload.
|
||||
const char* Animator::FrameParity() {
|
||||
return (frame_number_ % 2) ? "even" : "odd";
|
||||
}
|
||||
|
||||
static int64_t FxlToDartOrEarlier(fxl::TimePoint time) {
|
||||
int64_t dart_now = Dart_TimelineGetMicros();
|
||||
fxl::TimePoint fxl_now = fxl::TimePoint::Now();
|
||||
@@ -76,7 +82,11 @@ void Animator::BeginFrame(fxl::TimePoint frame_start_time,
|
||||
|
||||
last_begin_frame_time_ = frame_start_time;
|
||||
dart_frame_deadline_ = FxlToDartOrEarlier(frame_target_time);
|
||||
engine_->BeginFrame(last_begin_frame_time_);
|
||||
{
|
||||
TRACE_EVENT2("flutter", "Framework Workload", "mode", "basic", "frame",
|
||||
FrameParity());
|
||||
engine_->BeginFrame(last_begin_frame_time_);
|
||||
}
|
||||
|
||||
if (!frame_scheduled_) {
|
||||
// We don't have another frame pending, so we're waiting on user input
|
||||
@@ -95,12 +105,15 @@ void Animator::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
|
||||
// Commit the pending continuation.
|
||||
producer_continuation_.Complete(std::move(layer_tree));
|
||||
|
||||
blink::Threads::Gpu()->PostTask(
|
||||
[ rasterizer = rasterizer_, pipeline = layer_tree_pipeline_ ]() {
|
||||
if (!rasterizer.get())
|
||||
return;
|
||||
rasterizer->Draw(pipeline);
|
||||
});
|
||||
blink::Threads::Gpu()->PostTask([
|
||||
rasterizer = rasterizer_, pipeline = layer_tree_pipeline_,
|
||||
frame_id = FrameParity()
|
||||
]() {
|
||||
if (!rasterizer.get())
|
||||
return;
|
||||
TRACE_EVENT2("flutter", "GPU Workload", "mode", "basic", "frame", frame_id);
|
||||
rasterizer->Draw(pipeline);
|
||||
});
|
||||
}
|
||||
|
||||
void Animator::RequestFrame() {
|
||||
|
||||
@@ -40,6 +40,8 @@ class Animator {
|
||||
|
||||
void AwaitVSync();
|
||||
|
||||
const char* FrameParity();
|
||||
|
||||
fxl::WeakPtr<Rasterizer> rasterizer_;
|
||||
VsyncWaiter* waiter_;
|
||||
Engine* engine_;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "flutter/shell/platform/android/vsync_waiter_android.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
#include "flutter/common/threads.h"
|
||||
@@ -59,8 +60,16 @@ static void OnNativeVsync(JNIEnv* env,
|
||||
// Vsync" checkbox in the timeline can be enabled.
|
||||
// See: https://github.com/catapult-project/catapult/blob/2091404475cbba9b786
|
||||
// 442979b6ec631305275a6/tracing/tracing/extras/vsync/vsync_auditor.html#L26
|
||||
TRACE_EVENT0("flutter", "VSYNC");
|
||||
TRACE_EVENT_INSTANT0("flutter", "VSYNC");
|
||||
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE
|
||||
TRACE_EVENT1("flutter", "VSYNC", "mode", "basic");
|
||||
#else
|
||||
{
|
||||
constexpr size_t num_chars = sizeof(jlong) * CHAR_BIT * 3.4 + 2;
|
||||
char deadline[num_chars];
|
||||
sprintf(deadline, "%lld", frameTargetTimeNanos / 1000); // microseconds
|
||||
TRACE_EVENT2("flutter", "VSYNC", "mode", "basic", "deadline", deadline);
|
||||
}
|
||||
#endif
|
||||
fxl::WeakPtr<VsyncWaiterAndroid>* weak =
|
||||
reinterpret_cast<fxl::WeakPtr<VsyncWaiterAndroid>*>(cookie);
|
||||
VsyncWaiterAndroid* waiter = weak->get();
|
||||
|
||||
@@ -52,6 +52,21 @@
|
||||
|
||||
_displayLink.paused = YES;
|
||||
|
||||
// Note: The tag name must be "VSYNC" (it is special) so that the "Highlight
|
||||
// Vsync" checkbox in the timeline can be enabled.
|
||||
// See: https://github.com/catapult-project/catapult/blob/2091404475cbba9b786
|
||||
// 442979b6ec631305275a6/tracing/tracing/extras/vsync/vsync_auditor.html#L26
|
||||
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_RELEASE
|
||||
TRACE_EVENT1("flutter", "VSYNC", "mode", "basic");
|
||||
#else
|
||||
{
|
||||
constexpr size_t num_chars = sizeof(fxl::TimePoint) * CHAR_BIT * 3.4 + 2;
|
||||
char deadline[num_chars];
|
||||
sprintf(deadline, "%lld", frame_target_time / 1000); // microseconds
|
||||
TRACE_EVENT2("flutter", "VSYNC", "mode", "basic", "deadline", deadline);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Note: Even though we know we are on the UI thread already (since the
|
||||
// display link was scheduled on the UI thread in the contructor), we use
|
||||
// the PostTask mechanism because the callback may have side-effects that need
|
||||
|
||||
Reference in New Issue
Block a user