| 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
|
|
|