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
3 // found in the LICENSE file.
5 #include "cc/debug/rendering_stats.h"
9 RenderingStats::RenderingStats()
10 : animation_frame_count(0),
11 screen_frame_count(0),
12 dropped_frame_count(0),
13 total_commit_count(0),
14 total_pixels_painted(0),
15 total_pixels_recorded(0),
16 total_pixels_rasterized(0),
17 num_impl_thread_scrolls(0),
18 num_main_thread_scrolls(0),
21 total_deferred_image_decode_count(0),
22 total_deferred_image_cache_hit_count(0),
23 total_image_gathering_count(0),
24 total_tiles_analyzed(0),
25 solid_color_tiles_analyzed(0) {}
27 void RenderingStats::EnumerateFields(Enumerator
* enumerator
) const {
28 enumerator
->AddInt64("numAnimationFrames", animation_frame_count
);
29 enumerator
->AddInt64("numFramesSentToScreen", screen_frame_count
);
30 enumerator
->AddInt64("droppedFrameCount", dropped_frame_count
);
31 enumerator
->AddDouble("totalPaintTimeInSeconds",
32 total_paint_time
.InSecondsF());
33 enumerator
->AddDouble("totalRecordTimeInSeconds",
34 total_record_time
.InSecondsF());
35 enumerator
->AddDouble("totalRasterizeTimeInSeconds",
36 total_rasterize_time
.InSecondsF());
37 enumerator
->AddDouble(
38 "totalRasterizeTimeForNowBinsOnPendingTree",
39 total_rasterize_time_for_now_bins_on_pending_tree
.InSecondsF());
40 enumerator
->AddDouble("totalCommitTimeInSeconds",
41 total_commit_time
.InSecondsF());
42 enumerator
->AddDouble("bestRasterizeTimeInSeconds",
43 best_rasterize_time
.InSecondsF());
44 enumerator
->AddInt64("totalCommitCount", total_commit_count
);
45 enumerator
->AddInt64("totalPixelsPainted", total_pixels_painted
);
46 enumerator
->AddInt64("totalPixelsRecorded", total_pixels_recorded
);
47 enumerator
->AddInt64("totalPixelsRasterized", total_pixels_rasterized
);
48 enumerator
->AddInt64("numImplThreadScrolls", num_impl_thread_scrolls
);
49 enumerator
->AddInt64("numMainThreadScrolls", num_main_thread_scrolls
);
50 enumerator
->AddInt64("numLayersDrawn", num_layers_drawn
);
51 enumerator
->AddInt64("numMissingTiles", num_missing_tiles
);
52 enumerator
->AddInt64("totalDeferredImageDecodeCount",
53 total_deferred_image_decode_count
);
54 enumerator
->AddInt64("totalTilesAnalyzed", total_tiles_analyzed
);
55 enumerator
->AddInt64("solidColorTilesAnalyzed",
56 solid_color_tiles_analyzed
);
57 enumerator
->AddInt64("totalDeferredImageCacheHitCount",
58 total_deferred_image_cache_hit_count
);
59 enumerator
->AddInt64("totalImageGatheringCount",
60 total_image_gathering_count
);
61 enumerator
->AddDouble("totalDeferredImageDecodeTimeInSeconds",
62 total_deferred_image_decode_time
.InSecondsF());
63 enumerator
->AddDouble("totalImageGatheringTimeInSeconds",
64 total_image_gathering_time
.InSecondsF());
65 enumerator
->AddDouble("totalTileAnalysisTimeInSeconds",
66 total_tile_analysis_time
.InSecondsF());
69 void RenderingStats::Add(const RenderingStats
& other
) {
70 animation_frame_count
+= other
.animation_frame_count
;
71 screen_frame_count
+= other
.screen_frame_count
;
72 dropped_frame_count
+= other
.dropped_frame_count
;
73 total_paint_time
+= other
.total_paint_time
;
74 total_record_time
+= other
.total_record_time
;
75 total_rasterize_time
+= other
.total_rasterize_time
;
76 total_rasterize_time_for_now_bins_on_pending_tree
+=
77 other
.total_rasterize_time_for_now_bins_on_pending_tree
;
78 total_commit_time
+= other
.total_commit_time
;
79 best_rasterize_time
+= other
.best_rasterize_time
;
80 total_commit_count
+= other
.total_commit_count
;
81 total_pixels_painted
+= other
.total_pixels_painted
;
82 total_pixels_recorded
+= other
.total_pixels_recorded
;
83 total_pixels_rasterized
+= other
.total_pixels_rasterized
;
84 num_impl_thread_scrolls
+= other
.num_impl_thread_scrolls
;
85 num_main_thread_scrolls
+= other
.num_main_thread_scrolls
;
86 num_layers_drawn
+= other
.num_layers_drawn
;
87 num_missing_tiles
+= other
.num_missing_tiles
;
88 total_deferred_image_decode_count
+= other
.total_deferred_image_decode_count
;
89 total_deferred_image_cache_hit_count
+=
90 other
.total_deferred_image_cache_hit_count
;
91 total_image_gathering_count
+= other
.total_image_gathering_count
;
92 total_deferred_image_decode_time
+= other
.total_deferred_image_decode_time
;
93 total_image_gathering_time
+= other
.total_image_gathering_time
;
94 total_tiles_analyzed
+= other
.total_tiles_analyzed
;
95 solid_color_tiles_analyzed
+= other
.solid_color_tiles_analyzed
;
96 total_tile_analysis_time
+= other
.total_tile_analysis_time
;