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 #include "base/values.h" | 5 #include "base/values.h" |
6 #include "cc/debug/rendering_stats.h" | 6 #include "cc/debug/rendering_stats.h" |
7 | 7 |
8 namespace cc { | 8 namespace cc { |
9 | 9 |
10 MainThreadRenderingStats::MainThreadRenderingStats() | 10 MainThreadRenderingStats::MainThreadRenderingStats() |
(...skipping 13 matching lines...) Expand all Loading... | |
24 } | 24 } |
25 | 25 |
26 void MainThreadRenderingStats::Add(const MainThreadRenderingStats& other) { | 26 void MainThreadRenderingStats::Add(const MainThreadRenderingStats& other) { |
27 frame_count += other.frame_count; | 27 frame_count += other.frame_count; |
28 paint_time += other.paint_time; | 28 paint_time += other.paint_time; |
29 painted_pixel_count += other.painted_pixel_count; | 29 painted_pixel_count += other.painted_pixel_count; |
30 record_time += other.record_time; | 30 record_time += other.record_time; |
31 recorded_pixel_count += other.recorded_pixel_count; | 31 recorded_pixel_count += other.recorded_pixel_count; |
32 } | 32 } |
33 | 33 |
34 void ImplThreadRenderingStatsAccumulated::Append(base::TimeDelta value) { | |
35 values.push_back(value); | |
36 } | |
37 | |
38 scoped_ptr<base::Value> | |
39 ImplThreadRenderingStatsAccumulated::AsValueInMilliseconds() const { | |
ernstm
2014/07/14 13:12:39
The method name is a bit misleading. The return va
Dominik Grewe
2014/07/14 13:37:52
Done.
| |
40 scoped_ptr<base::ListValue> list_value(new base::ListValue); | |
41 std::list<base::TimeDelta>::const_iterator iter; | |
42 for (iter = values.begin(); iter != values.end(); ++iter) { | |
43 list_value->AppendDouble(iter->InMillisecondsF()); | |
44 } | |
45 return list_value.PassAs<base::Value>(); | |
46 } | |
47 | |
48 void ImplThreadRenderingStatsAccumulated::Add( | |
49 const ImplThreadRenderingStatsAccumulated& other) { | |
50 values.insert(values.end(), other.values.begin(), other.values.end()); | |
51 } | |
52 | |
34 ImplThreadRenderingStats::ImplThreadRenderingStats() | 53 ImplThreadRenderingStats::ImplThreadRenderingStats() |
35 : frame_count(0), | 54 : frame_count(0), |
36 rasterized_pixel_count(0), | 55 rasterized_pixel_count(0), |
37 visible_content_area(0), | 56 visible_content_area(0), |
38 approximated_visible_content_area(0) { | 57 approximated_visible_content_area(0) { |
39 } | 58 } |
40 | 59 |
41 scoped_refptr<base::debug::ConvertableToTraceFormat> | 60 scoped_refptr<base::debug::ConvertableToTraceFormat> |
42 ImplThreadRenderingStats::AsTraceableData() const { | 61 ImplThreadRenderingStats::AsTraceableData() const { |
43 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); | 62 scoped_ptr<base::DictionaryValue> record_data(new base::DictionaryValue()); |
44 record_data->SetInteger("frame_count", frame_count); | 63 record_data->SetInteger("frame_count", frame_count); |
45 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF()); | 64 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF()); |
46 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count); | 65 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count); |
47 record_data->SetInteger("visible_content_area", visible_content_area); | 66 record_data->SetInteger("visible_content_area", visible_content_area); |
48 record_data->SetInteger("approximated_visible_content_area", | 67 record_data->SetInteger("approximated_visible_content_area", |
49 approximated_visible_content_area); | 68 approximated_visible_content_area); |
69 record_data->Set("draw_duration_ms", | |
70 draw_duration.AsValueInMilliseconds().release()); | |
71 record_data->Set("draw_duration_estimate_ms", | |
72 draw_duration_estimate.AsValueInMilliseconds().release()); | |
73 record_data->Set( | |
74 "begin_main_frame_to_commit_duration_ms", | |
75 begin_main_frame_to_commit_duration.AsValueInMilliseconds().release()); | |
76 record_data->Set( | |
77 "begin_main_frame_to_commit_duration_estimate_ms", | |
78 begin_main_frame_to_commit_duration_estimate.AsValueInMilliseconds() | |
79 .release()); | |
80 record_data->Set( | |
81 "commit_to_activate_duration_ms", | |
82 commit_to_activate_duration.AsValueInMilliseconds().release()); | |
83 record_data->Set( | |
84 "commit_to_activate_duration_estimate_ms", | |
85 commit_to_activate_duration_estimate.AsValueInMilliseconds().release()); | |
50 return TracedValue::FromValue(record_data.release()); | 86 return TracedValue::FromValue(record_data.release()); |
51 } | 87 } |
52 | 88 |
53 void ImplThreadRenderingStats::Add(const ImplThreadRenderingStats& other) { | 89 void ImplThreadRenderingStats::Add(const ImplThreadRenderingStats& other) { |
54 frame_count += other.frame_count; | 90 frame_count += other.frame_count; |
55 rasterize_time += other.rasterize_time; | 91 rasterize_time += other.rasterize_time; |
56 analysis_time += other.analysis_time; | 92 analysis_time += other.analysis_time; |
57 rasterized_pixel_count += other.rasterized_pixel_count; | 93 rasterized_pixel_count += other.rasterized_pixel_count; |
58 visible_content_area += other.visible_content_area; | 94 visible_content_area += other.visible_content_area; |
59 approximated_visible_content_area += other.approximated_visible_content_area; | 95 approximated_visible_content_area += other.approximated_visible_content_area; |
96 | |
97 draw_duration.Add(other.draw_duration); | |
98 draw_duration_estimate.Add(other.draw_duration_estimate); | |
99 begin_main_frame_to_commit_duration.Add( | |
100 other.begin_main_frame_to_commit_duration); | |
101 begin_main_frame_to_commit_duration_estimate.Add( | |
102 other.begin_main_frame_to_commit_duration_estimate); | |
103 commit_to_activate_duration.Add(other.commit_to_activate_duration); | |
104 commit_to_activate_duration_estimate.Add( | |
105 other.commit_to_activate_duration_estimate); | |
60 } | 106 } |
61 | 107 |
62 void RenderingStats::Add(const RenderingStats& other) { | 108 void RenderingStats::Add(const RenderingStats& other) { |
63 main_stats.Add(other.main_stats); | 109 main_stats.Add(other.main_stats); |
64 impl_stats.Add(other.impl_stats); | 110 impl_stats.Add(other.impl_stats); |
65 } | 111 } |
66 | 112 |
67 } // namespace cc | 113 } // namespace cc |
OLD | NEW |