mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add anchor events for developer centric timeline (#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:
parent
0e8ffa24e0
commit
0c1e217287
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
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Signature: 6acb5ec35f946b04626e9b127e818708
|
||||
Signature: 1dbfd20015aaf7761e4f14c34f720089
|
||||
|
||||
UNUSED LICENSES:
|
||||
|
||||
@ -1499,6 +1499,8 @@ FILE: ../../../dart/runtime/bin/error_exit.h
|
||||
FILE: ../../../dart/runtime/bin/gzip.cc
|
||||
FILE: ../../../dart/runtime/bin/gzip.h
|
||||
FILE: ../../../dart/runtime/bin/isolate_data.cc
|
||||
FILE: ../../../dart/runtime/bin/main_options.cc
|
||||
FILE: ../../../dart/runtime/bin/main_options.h
|
||||
FILE: ../../../dart/runtime/bin/namespace.cc
|
||||
FILE: ../../../dart/runtime/bin/namespace.h
|
||||
FILE: ../../../dart/runtime/bin/namespace_android.cc
|
||||
@ -1507,6 +1509,8 @@ FILE: ../../../dart/runtime/bin/namespace_linux.cc
|
||||
FILE: ../../../dart/runtime/bin/namespace_macos.cc
|
||||
FILE: ../../../dart/runtime/bin/namespace_patch.dart
|
||||
FILE: ../../../dart/runtime/bin/namespace_win.cc
|
||||
FILE: ../../../dart/runtime/bin/options.cc
|
||||
FILE: ../../../dart/runtime/bin/options.h
|
||||
FILE: ../../../dart/runtime/bin/secure_socket_filter.cc
|
||||
FILE: ../../../dart/runtime/bin/secure_socket_filter.h
|
||||
FILE: ../../../dart/runtime/bin/secure_socket_utils.cc
|
||||
@ -1593,6 +1597,7 @@ FILE: ../../../dart/runtime/vm/timeline_win.cc
|
||||
FILE: ../../../dart/runtime/vm/zone_text_buffer.cc
|
||||
FILE: ../../../dart/runtime/vm/zone_text_buffer.h
|
||||
FILE: ../../../dart/sdk/lib/internal/linked_list.dart
|
||||
FILE: ../../../dart/sdk/lib/io/embedder_config.dart
|
||||
FILE: ../../../dart/sdk/lib/io/namespace_impl.dart
|
||||
FILE: ../../../dart/sdk/lib/io/sync_socket.dart
|
||||
FILE: ../../../dart/sdk/lib/vmservice/named_lookup.dart
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user