OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_DEBUG_RENDERING_STATS_H_ | 5 #ifndef CC_DEBUG_RENDERING_STATS_H_ |
6 #define CC_DEBUG_RENDERING_STATS_H_ | 6 #define CC_DEBUG_RENDERING_STATS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/debug/traced_value.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 struct CC_EXPORT RenderingStats { | 15 // In conjunction with EnumerateFields, this allows the embedder to |
15 int64 animation_frame_count; | 16 // enumerate the values in this structure without |
16 int64 screen_frame_count; | 17 // having to embed references to its specific member variables. This |
17 int64 dropped_frame_count; | 18 // simplifies the addition of new fields to this type. |
18 base::TimeDelta total_paint_time; | 19 class RenderingStatsEnumerator { |
19 base::TimeDelta total_record_time; | 20 public: |
20 base::TimeDelta total_rasterize_time; | 21 virtual void AddInt64(const char* name, int64 value) = 0; |
21 base::TimeDelta total_rasterize_time_for_now_bins_on_pending_tree; | 22 virtual void AddDouble(const char* name, double value) = 0; |
22 base::TimeDelta total_commit_time; | 23 virtual void AddInt(const char* name, int value) = 0; |
23 base::TimeDelta best_rasterize_time; | 24 virtual void AddTimeDeltaInSecondsF(const char* name, |
24 int64 total_commit_count; | 25 const base::TimeDelta& value) = 0; |
25 int64 total_pixels_painted; | 26 |
26 int64 total_pixels_recorded; | 27 protected: |
27 int64 total_pixels_rasterized; | 28 virtual ~RenderingStatsEnumerator() {} |
28 int64 num_impl_thread_scrolls; | 29 }; |
29 int64 num_main_thread_scrolls; | 30 |
30 int64 num_layers_drawn; | 31 struct CC_EXPORT MainThreadRenderingStats { |
31 int64 num_missing_tiles; | |
32 int64 total_deferred_image_decode_count; | |
33 int64 total_deferred_image_cache_hit_count; | |
34 int64 total_image_gathering_count; | |
35 int64 total_tiles_analyzed; | |
36 int64 solid_color_tiles_analyzed; | |
37 base::TimeDelta total_deferred_image_decode_time; | |
38 base::TimeDelta total_image_gathering_time; | |
39 base::TimeDelta total_tile_analysis_time; | |
40 // Note: when adding new members, please remember to update EnumerateFields | 32 // Note: when adding new members, please remember to update EnumerateFields |
41 // and Add in rendering_stats.cc. | 33 // and Add in rendering_stats.cc. |
42 | 34 |
43 RenderingStats(); | 35 int64 animation_frame_count; |
| 36 int64 screen_frame_count; |
| 37 base::TimeDelta paint_time; |
| 38 base::TimeDelta record_time; |
| 39 base::TimeDelta commit_time; |
| 40 int64 commit_count; |
| 41 int64 painted_pixel_count; |
| 42 int64 recorded_pixel_count; |
| 43 int64 image_gathering_count; |
| 44 base::TimeDelta image_gathering_time; |
44 | 45 |
45 // In conjunction with EnumerateFields, this allows the embedder to | 46 MainThreadRenderingStats(); |
46 // enumerate the values in this structure without | 47 scoped_ptr<base::debug::ConvertableToTraceFormat> AsTraceableData() const; |
47 // having to embed references to its specific member variables. This | 48 void Add(const MainThreadRenderingStats& other); |
48 // simplifies the addition of new fields to this type. | 49 }; |
49 class Enumerator { | |
50 public: | |
51 virtual void AddInt64(const char* name, int64 value) = 0; | |
52 virtual void AddDouble(const char* name, double value) = 0; | |
53 virtual void AddInt(const char* name, int value) = 0; | |
54 virtual void AddTimeDeltaInSecondsF(const char* name, | |
55 const base::TimeDelta& value) = 0; | |
56 | 50 |
57 protected: | 51 struct CC_EXPORT ImplThreadRenderingStats { |
58 virtual ~Enumerator() {} | 52 // Note: when adding new members, please remember to update EnumerateFields |
59 }; | 53 // and Add in rendering_stats.cc. |
| 54 |
| 55 int64 screen_frame_count; |
| 56 int64 dropped_frame_count; |
| 57 base::TimeDelta rasterize_time; |
| 58 base::TimeDelta rasterize_time_for_now_bins_on_pending_tree; |
| 59 base::TimeDelta best_rasterize_time; |
| 60 int64 rasterized_pixel_count; |
| 61 int64 impl_thread_scroll_count; |
| 62 int64 main_thread_scroll_count; |
| 63 int64 drawn_layer_count; |
| 64 int64 missing_tile_count; |
| 65 int64 deferred_image_decode_count; |
| 66 int64 deferred_image_cache_hit_count; |
| 67 int64 tile_analysis_count; |
| 68 int64 solid_color_tile_analysis_count; |
| 69 base::TimeDelta deferred_image_decode_time; |
| 70 base::TimeDelta tile_analysis_time; |
| 71 |
| 72 ImplThreadRenderingStats(); |
| 73 scoped_ptr<base::debug::ConvertableToTraceFormat> AsTraceableData() const; |
| 74 void Add(const ImplThreadRenderingStats& other); |
| 75 }; |
| 76 |
| 77 struct CC_EXPORT RenderingStats { |
| 78 typedef RenderingStatsEnumerator Enumerator; |
| 79 |
| 80 MainThreadRenderingStats main_stats; |
| 81 ImplThreadRenderingStats impl_stats; |
60 | 82 |
61 // Outputs the fields in this structure to the provided enumerator. | 83 // Outputs the fields in this structure to the provided enumerator. |
62 void EnumerateFields(Enumerator* enumerator) const; | 84 void EnumerateFields(Enumerator* enumerator) const; |
63 | 85 |
64 // Add fields of |other| to the fields in this structure. | 86 // Add fields of |other| to the fields in this structure. |
65 void Add(const RenderingStats& other); | 87 void Add(const RenderingStats& other); |
66 }; | 88 }; |
67 | 89 |
68 } // namespace cc | 90 } // namespace cc |
69 | 91 |
70 #endif // CC_DEBUG_RENDERING_STATS_H_ | 92 #endif // CC_DEBUG_RENDERING_STATS_H_ |
OLD | NEW |