| OLD | NEW |
| (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 virtual ~RenderingStatsInstrumentation(); |
| 20 |
| 21 RenderingStats GetRenderingStats(); |
| 22 |
| 23 // Read and write access to the record_rendering_stats_ flag is not locked to |
| 24 // improve performance. The flag is commonly turned off and hardly changes |
| 25 // it's value during runtime. |
| 26 bool record_rendering_stats() const { return record_rendering_stats_; } |
| 27 void set_record_rendering_stats(bool record_rendering_stats) { |
| 28 if (record_rendering_stats_ != record_rendering_stats) |
| 29 record_rendering_stats_ = record_rendering_stats; |
| 30 } |
| 31 |
| 32 base::TimeTicks StartRecording() const; |
| 33 base::TimeDelta EndRecording(base::TimeTicks start_time) const; |
| 34 |
| 35 // TODO(egraether): Remove after switching Layer::update() to use this class. |
| 36 // Used in LayerTreeHost::paintLayerContents(). |
| 37 void AddStats(const RenderingStats& other); |
| 38 |
| 39 void IncrementAnimationFrameCount(); |
| 40 void SetScreenFrameCount(int64 count); |
| 41 void SetDroppedFrameCount(int64 count); |
| 42 |
| 43 void AddCommit(base::TimeDelta duration); |
| 44 void AddPaint(base::TimeDelta duration, int64 pixels); |
| 45 void AddRaster(base::TimeDelta duration, |
| 46 int64 pixels, |
| 47 bool is_in_pending_tree_now_bin); |
| 48 |
| 49 void IncrementImplThreadScrolls(); |
| 50 void IncrementMainThreadScrolls(); |
| 51 |
| 52 void AddLayersDrawn(int64 amount); |
| 53 void AddMissingTiles(int64 amount); |
| 54 |
| 55 void AddDeferredImageDecode(base::TimeDelta duration); |
| 56 void AddImageGathering(base::TimeDelta duration); |
| 57 |
| 58 void IncrementDeferredImageCacheHitCount(); |
| 59 |
| 60 protected: |
| 61 RenderingStatsInstrumentation(); |
| 62 |
| 63 private: |
| 64 RenderingStats rendering_stats_; |
| 65 bool record_rendering_stats_; |
| 66 |
| 67 base::Lock lock_; |
| 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(RenderingStatsInstrumentation); |
| 70 }; |
| 71 |
| 72 } // namespace cc |
| 73 |
| 74 #endif // CC_RENDERING_STATS_INSTRUMENTATION_H_ |
| OLD | NEW |