From dcd3874530e97ca794c9e69905b312da9dcd4f45 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 23 Aug 2016 17:03:38 -0700 Subject: [PATCH] Keep track on the layer tree construction time in the animator. (#2968) --- flow/layers/layer_tree.h | 2 ++ sky/shell/ui/animator.cc | 9 ++++++++- sky/shell/ui/animator.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/flow/layers/layer_tree.h b/flow/layers/layer_tree.h index a20546747..38ef1628b 100644 --- a/flow/layers/layer_tree.h +++ b/flow/layers/layer_tree.h @@ -20,6 +20,7 @@ namespace flow { class LayerTree { public: LayerTree(); + ~LayerTree(); void Raster(CompositorContext::ScopedFrame& frame); @@ -41,6 +42,7 @@ class LayerTree { void set_frame_size(const SkISize& frame_size) { frame_size_ = frame_size; } uint32_t scene_version() const { return scene_version_; } + void set_scene_version(uint32_t scene_version) { scene_version_ = scene_version; } diff --git a/sky/shell/ui/animator.cc b/sky/shell/ui/animator.cc index d00fc0f35..d9a94d4af 100644 --- a/sky/shell/ui/animator.cc +++ b/sky/shell/ui/animator.cc @@ -64,10 +64,17 @@ void Animator::BeginFrame(int64_t time_stamp) { // to service potential frame. DCHECK(producer_continuation_); - engine_->BeginFrame(ftl::TimePoint::Now()); + last_begin_frame_time_ = ftl::TimePoint::Now(); + engine_->BeginFrame(last_begin_frame_time_); } void Animator::Render(std::unique_ptr layer_tree) { + if (layer_tree) { + // Note the frame time for instrumentation. + layer_tree->set_construction_time(ftl::TimePoint::Now() - + last_begin_frame_time_); + } + // Commit the pending continuation. producer_continuation_.Complete(std::move(layer_tree)); diff --git a/sky/shell/ui/animator.h b/sky/shell/ui/animator.h index f79340f59..738a68762 100644 --- a/sky/shell/ui/animator.h +++ b/sky/shell/ui/animator.h @@ -45,6 +45,7 @@ class Animator { Engine* engine_; vsync::VSyncProviderPtr vsync_provider_; vsync::VSyncProviderPtr fallback_vsync_provider_; + ftl::TimePoint last_begin_frame_time_; ftl::RefPtr layer_tree_pipeline_; flutter::Semaphore pending_frame_semaphore_; LayerTreePipeline::ProducerContinuation producer_continuation_; -- GitLab