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

Side by Side Diff: cc/debug/rendering_stats_instrumentation.h

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to LayerTreeTest Created 7 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_RENDERING_STATS_INSTRUMENTATION_H_
6 #define CC_RENDERING_STATS_INSTRUMENTATION_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/synchronization/lock.h"
10 #include "cc/debug/rendering_stats.h"
11
12 namespace cc {
13
14 // RenderingStatsInstrumentation is shared among threads and manages conditional
15 // recording of rendering stats into a private RenderingStats instance.
16 class CC_EXPORT RenderingStatsInstrumentation {
17 public:
18 static scoped_ptr<RenderingStatsInstrumentation> Create();
19
20 RenderingStats GetRenderingStats();
21
22 // Read and write access to the record_rendering_stats_ flag is not locked to
23 // improve performance. The flag is commonly turned off and hardly changes
24 // it's value during runtime.
25 bool record_rendering_stats() const { return record_rendering_stats_; }
26 void set_record_rendering_stats(bool record_rendering_stats) {
27 if (record_rendering_stats_ != record_rendering_stats)
28 record_rendering_stats_ = record_rendering_stats;
29 }
30
31 base::TimeTicks StartRecording() const;
32 base::TimeDelta EndRecording(base::TimeTicks start_time) const;
33
34 // TODO(egraether): Remove after switching Layer::update() to use this class.
35 // Used in LayerTreeHost::paintLayerContents().
36 void AddStats(const RenderingStats& other);
37
38 void IncrementAnimationFrameCount();
39 void SetScreenFrameCount(int64 count);
40 void SetDroppedFrameCount(int64 count);
41
42 void AddCommit(base::TimeDelta duration);
43 void AddPaint(base::TimeDelta duration, int64 pixels);
44 void AddRaster(base::TimeDelta duration,
45 int64 pixels,
46 bool is_in_pending_tree_now_bin);
47
48 void IncrementImplThreadScrolls();
49 void IncrementMainThreadScrolls();
50
51 void AddLayersDrawn(int64 amount);
52 void AddMissingTiles(int64 amount);
53
54 void AddDeferredImageDecode(base::TimeDelta duration);
55 void AddImageGathering(base::TimeDelta duration);
56
57 void IncrementDeferredImageCacheHitCount();
58
59 private:
60 RenderingStatsInstrumentation();
61
62 RenderingStats rendering_stats_;
63 bool record_rendering_stats_;
64
65 base::Lock lock_;
66
67 DISALLOW_COPY_AND_ASSIGN(RenderingStatsInstrumentation);
68 };
69
70 } // namespace cc
71
72 #endif // CC_RENDERING_STATS_INSTRUMENTATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698