summaryrefslogtreecommitdiffstats
path: root/cc/debug/picture_record_benchmark.h
blob: 89f2bc0781e4ddf5cc03709409d03fbbd9b2715f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2013 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.

#ifndef CC_DEBUG_PICTURE_RECORD_BENCHMARK_H_
#define CC_DEBUG_PICTURE_RECORD_BENCHMARK_H_

#include <map>
#include <utility>
#include <vector>

#include "base/time/time.h"
#include "cc/debug/micro_benchmark_controller.h"

namespace cc {

class LayerTreeHost;
class Layer;
class CC_EXPORT PictureRecordBenchmark : public MicroBenchmark {
 public:
  explicit PictureRecordBenchmark(scoped_ptr<base::Value> value,
                                  const MicroBenchmark::DoneCallback& callback);
  virtual ~PictureRecordBenchmark();

  // Implements MicroBenchmark interface.
  virtual void DidUpdateLayers(LayerTreeHost* host) OVERRIDE;
  virtual void RunOnLayer(PictureLayer* layer) OVERRIDE;

 private:
  void Run(Layer* layer);

  typedef std::pair<base::TimeDelta, unsigned> TotalTime;
  std::map<std::pair<int, int>, TotalTime> times_;
  std::vector<std::pair<int, int> > dimensions_;
};

}  // namespace cc

#endif  // CC_DEBUG_PICTURE_RECORD_BENCHMARK_H_