From 3cce3f0d7e201851ec80514bea7136ca01084af4 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 9 Jan 2016 00:48:42 -0800 Subject: [PATCH] Add some more trace events to the compositor --- sky/compositor/layer_tree.cc | 14 +++++++++++--- sky/compositor/raster_cache.cc | 6 +++++- sky/engine/core/script/dart_init.cc | 3 +++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sky/compositor/layer_tree.cc b/sky/compositor/layer_tree.cc index 39e742cf8c9..4200eb365da 100644 --- a/sky/compositor/layer_tree.cc +++ b/sky/compositor/layer_tree.cc @@ -4,6 +4,7 @@ #include "sky/compositor/layer_tree.h" +#include "base/trace_event/trace_event.h" #include "sky/compositor/layer.h" namespace sky { @@ -16,9 +17,16 @@ LayerTree::~LayerTree() { } void LayerTree::Raster(PaintContext::ScopedFrame& frame) { - Layer::PrerollContext context = { frame, SkRect::MakeEmpty() }; - root_layer_->Preroll(&context, SkMatrix()); - root_layer_->Paint(frame); + { + TRACE_EVENT0("flutter", "LayerTree::Preroll") + Layer::PrerollContext context = { frame, SkRect::MakeEmpty() }; + root_layer_->Preroll(&context, SkMatrix()); + } + + { + TRACE_EVENT0("flutter", "LayerTree::Paint") + root_layer_->Paint(frame); + } } } // namespace compositor diff --git a/sky/compositor/raster_cache.cc b/sky/compositor/raster_cache.cc index 1364092bc1c..436cb1cb084 100644 --- a/sky/compositor/raster_cache.cc +++ b/sky/compositor/raster_cache.cc @@ -4,8 +4,9 @@ #include "sky/compositor/raster_cache.h" -#include "sky/compositor/paint_context.h" #include "base/logging.h" +#include "base/trace_event/trace_event.h" +#include "sky/compositor/paint_context.h" #include "third_party/skia/include/core/SkImage.h" #define ENABLE_RASTER_CACHE 0 @@ -73,6 +74,9 @@ RefPtr RasterCache::GetPrerolledImage(GrContext* context, entry.access_count = kRasterThreshold; if (!entry.image && isWorthRasterizing(picture)) { + TRACE_EVENT2("flutter", "Rasterize picture layer", + "width", physical_size.width(), + "height", physical_size.height()); SkMatrix matrix = SkMatrix::MakeScale(scaleX, scaleY); entry.image = adoptRef(SkImage::NewFromPicture(picture, physical_size, &matrix, nullptr)); diff --git a/sky/engine/core/script/dart_init.cc b/sky/engine/core/script/dart_init.cc index 17f35e5bffc..03b442198c9 100644 --- a/sky/engine/core/script/dart_init.cc +++ b/sky/engine/core/script/dart_init.cc @@ -72,6 +72,9 @@ static const char* kDartArgs[] = { // default profile period to 100Hz. This number is suitable for older // Raspberry Pi devices but quite low for current smartphones. "--profile_period=1000", + // Background compilation isn't quite ready, but this flag turns it on if we + // want to experiment with it. + // "--background_compilation", #if (WTF_OS_IOS || WTF_OS_MACOSX) // On platforms where LLDB is the primary debugger, SIGPROF signals // overwhelm LLDB.