Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2916)

Unified Diff: cc/debug/smoothness_timing_tracker.cc

Issue 397443002: [not for review] Add Draw entries to window Performance Timeline Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use damage rect not viewport rect Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/debug/smoothness_timing_tracker.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/smoothness_timing_tracker.cc
diff --git a/cc/debug/smoothness_timing_tracker.cc b/cc/debug/smoothness_timing_tracker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e35238e59e7f2fc86e3a9934ccd02ee79ecb02c5
--- /dev/null
+++ b/cc/debug/smoothness_timing_tracker.cc
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/debug/smoothness_timing_tracker.h"
+
+#include <algorithm>
+#include <limits>
+
+#include "base/metrics/histogram.h"
+#include "cc/trees/proxy.h"
+
+namespace cc {
+
+// static
+scoped_ptr<SmoothnessTimingTracker> SmoothnessTimingTracker::Create() {
+ return make_scoped_ptr(new SmoothnessTimingTracker);
+}
+
+SmoothnessTimingTracker::SmoothnessTimingTracker() {
+}
+
+void SmoothnessTimingTracker::SaveTimeStamps(
+ base::TimeTicks timestamp,
+ const std::vector<std::pair<int, int64_t> >& frame_ids) {
+ for (std::vector<std::pair<int, int64_t> >::const_iterator it =
+ frame_ids.begin();
+ it != frame_ids.end();
+ ++it) {
+ SmoothnessTimingCompositeEvent smoothness_timing_composite_event(
+ it->first, it->second, timestamp);
+ ring_buffer_.SaveToBuffer(smoothness_timing_composite_event);
+ }
+}
+
+scoped_ptr<CompositeTimingSet>
+SmoothnessTimingTracker::CalculateCompositeCounts() {
+ typedef base::hash_map<int64_t,
+ std::vector<std::pair<int, base::TimeTicks> > >
+ TicksByRectId;
+ TicksByRectId id_map;
+ for (RingBufferType::Iterator it = begin(); it; ++it) {
+ id_map[it->rect_id_].push_back(
+ std::make_pair(it->frame_id_, it->timestamp_));
+ }
+ scoped_ptr<CompositeTimingSet> composite_info(new CompositeTimingSet);
+ for (TicksByRectId::iterator id = id_map.begin(); id != id_map.end(); ++id) {
+ LayerTreeHostCommon::CompositeTimingInfo composite;
+ composite.rect_id = id->first;
+ composite.timestamps = id->second;
+ std::sort(composite.timestamps.begin(), composite.timestamps.end());
+ composite_info->composites.push_back(composite);
+ }
+ return composite_info.Pass();
+}
+
+} // namespace cc
« no previous file with comments | « cc/debug/smoothness_timing_tracker.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698