| 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 "cc/debug/rendering_stats.h" | 5 #include "cc/debug/rendering_stats.h" |
| 6 | 6 |
| 7 namespace cc { | 7 namespace cc { |
| 8 | 8 |
| 9 RenderingStats::TimeDeltaList::TimeDeltaList() { | 9 RenderingStats::TimeDeltaList::TimeDeltaList() { |
| 10 } | 10 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 std::list<base::TimeDelta>::const_iterator iter; | 21 std::list<base::TimeDelta>::const_iterator iter; |
| 22 for (iter = values.begin(); iter != values.end(); ++iter) { | 22 for (iter = values.begin(); iter != values.end(); ++iter) { |
| 23 list_value->AppendDouble(iter->InMillisecondsF()); | 23 list_value->AppendDouble(iter->InMillisecondsF()); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) { | 27 void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) { |
| 28 values.insert(values.end(), other.values.begin(), other.values.end()); | 28 values.insert(values.end(), other.values.begin(), other.values.end()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 base::TimeDelta RenderingStats::TimeDeltaList::GetLastTimeDelta() const { |
| 32 return values.empty() ? base::TimeDelta() : values.back(); |
| 33 } |
| 34 |
| 31 RenderingStats::MainThreadRenderingStats::MainThreadRenderingStats() | 35 RenderingStats::MainThreadRenderingStats::MainThreadRenderingStats() |
| 32 : painted_pixel_count(0), recorded_pixel_count(0) { | 36 : painted_pixel_count(0), recorded_pixel_count(0) { |
| 33 } | 37 } |
| 34 | 38 |
| 35 RenderingStats::MainThreadRenderingStats::~MainThreadRenderingStats() { | 39 RenderingStats::MainThreadRenderingStats::~MainThreadRenderingStats() { |
| 36 } | 40 } |
| 37 | 41 |
| 38 scoped_refptr<base::debug::ConvertableToTraceFormat> | 42 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 39 RenderingStats::MainThreadRenderingStats::AsTraceableData() const { | 43 RenderingStats::MainThreadRenderingStats::AsTraceableData() const { |
| 40 scoped_refptr<base::debug::TracedValue> record_data = | 44 scoped_refptr<base::debug::TracedValue> record_data = |
| 41 new base::debug::TracedValue(); | 45 new base::debug::TracedValue(); |
| 42 record_data->SetDouble("paint_time", paint_time.InSecondsF()); | 46 record_data->SetDouble("paint_time", paint_time.InSecondsF()); |
| 43 record_data->SetInteger("painted_pixel_count", painted_pixel_count); | 47 record_data->SetInteger("painted_pixel_count", painted_pixel_count); |
| 44 record_data->SetDouble("record_time", record_time.InSecondsF()); | 48 record_data->SetDouble("record_time", record_time.InSecondsF()); |
| 45 record_data->SetInteger("recorded_pixel_count", recorded_pixel_count); | 49 record_data->SetInteger("recorded_pixel_count", recorded_pixel_count); |
| 46 return record_data; | 50 return record_data; |
| 47 } | 51 } |
| 48 | 52 |
| 49 void RenderingStats::MainThreadRenderingStats::Add( | 53 void RenderingStats::MainThreadRenderingStats::Add( |
| 50 const MainThreadRenderingStats& other) { | 54 const MainThreadRenderingStats& other) { |
| 51 paint_time += other.paint_time; | 55 paint_time += other.paint_time; |
| 52 painted_pixel_count += other.painted_pixel_count; | 56 painted_pixel_count += other.painted_pixel_count; |
| 53 record_time += other.record_time; | 57 record_time += other.record_time; |
| 54 recorded_pixel_count += other.recorded_pixel_count; | 58 recorded_pixel_count += other.recorded_pixel_count; |
| 55 } | 59 } |
| 56 | 60 |
| 57 RenderingStats::ImplThreadRenderingStats::ImplThreadRenderingStats() | 61 RenderingStats::ImplThreadRenderingStats::ImplThreadRenderingStats() |
| 58 : frame_count(0), | 62 : frame_count(0), |
| 59 rasterized_pixel_count(0), | |
| 60 visible_content_area(0), | 63 visible_content_area(0), |
| 61 approximated_visible_content_area(0) { | 64 approximated_visible_content_area(0) { |
| 62 } | 65 } |
| 63 | 66 |
| 64 RenderingStats::ImplThreadRenderingStats::~ImplThreadRenderingStats() { | 67 RenderingStats::ImplThreadRenderingStats::~ImplThreadRenderingStats() { |
| 65 } | 68 } |
| 66 | 69 |
| 67 scoped_refptr<base::debug::ConvertableToTraceFormat> | 70 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 68 RenderingStats::ImplThreadRenderingStats::AsTraceableData() const { | 71 RenderingStats::ImplThreadRenderingStats::AsTraceableData() const { |
| 69 scoped_refptr<base::debug::TracedValue> record_data = | 72 scoped_refptr<base::debug::TracedValue> record_data = |
| 70 new base::debug::TracedValue(); | 73 new base::debug::TracedValue(); |
| 71 record_data->SetInteger("frame_count", frame_count); | 74 record_data->SetInteger("frame_count", frame_count); |
| 72 record_data->SetDouble("rasterize_time", rasterize_time.InSecondsF()); | |
| 73 record_data->SetInteger("rasterized_pixel_count", rasterized_pixel_count); | |
| 74 record_data->SetInteger("visible_content_area", visible_content_area); | 75 record_data->SetInteger("visible_content_area", visible_content_area); |
| 75 record_data->SetInteger("approximated_visible_content_area", | 76 record_data->SetInteger("approximated_visible_content_area", |
| 76 approximated_visible_content_area); | 77 approximated_visible_content_area); |
| 77 record_data->BeginArray("draw_duration_ms"); | 78 record_data->BeginArray("draw_duration_ms"); |
| 78 draw_duration.AddToTracedValue(record_data.get()); | 79 draw_duration.AddToTracedValue(record_data.get()); |
| 79 record_data->EndArray(); | 80 record_data->EndArray(); |
| 80 | 81 |
| 81 record_data->BeginArray("draw_duration_estimate_ms"); | 82 record_data->BeginArray("draw_duration_estimate_ms"); |
| 82 draw_duration_estimate.AddToTracedValue(record_data.get()); | 83 draw_duration_estimate.AddToTracedValue(record_data.get()); |
| 83 record_data->EndArray(); | 84 record_data->EndArray(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 | 98 |
| 98 record_data->BeginArray("commit_to_activate_duration_estimate_ms"); | 99 record_data->BeginArray("commit_to_activate_duration_estimate_ms"); |
| 99 commit_to_activate_duration_estimate.AddToTracedValue(record_data.get()); | 100 commit_to_activate_duration_estimate.AddToTracedValue(record_data.get()); |
| 100 record_data->EndArray(); | 101 record_data->EndArray(); |
| 101 return record_data; | 102 return record_data; |
| 102 } | 103 } |
| 103 | 104 |
| 104 void RenderingStats::ImplThreadRenderingStats::Add( | 105 void RenderingStats::ImplThreadRenderingStats::Add( |
| 105 const ImplThreadRenderingStats& other) { | 106 const ImplThreadRenderingStats& other) { |
| 106 frame_count += other.frame_count; | 107 frame_count += other.frame_count; |
| 107 rasterize_time += other.rasterize_time; | |
| 108 analysis_time += other.analysis_time; | |
| 109 rasterized_pixel_count += other.rasterized_pixel_count; | |
| 110 visible_content_area += other.visible_content_area; | 108 visible_content_area += other.visible_content_area; |
| 111 approximated_visible_content_area += other.approximated_visible_content_area; | 109 approximated_visible_content_area += other.approximated_visible_content_area; |
| 112 | 110 |
| 113 draw_duration.Add(other.draw_duration); | 111 draw_duration.Add(other.draw_duration); |
| 114 draw_duration_estimate.Add(other.draw_duration_estimate); | 112 draw_duration_estimate.Add(other.draw_duration_estimate); |
| 115 begin_main_frame_to_commit_duration.Add( | 113 begin_main_frame_to_commit_duration.Add( |
| 116 other.begin_main_frame_to_commit_duration); | 114 other.begin_main_frame_to_commit_duration); |
| 117 begin_main_frame_to_commit_duration_estimate.Add( | 115 begin_main_frame_to_commit_duration_estimate.Add( |
| 118 other.begin_main_frame_to_commit_duration_estimate); | 116 other.begin_main_frame_to_commit_duration_estimate); |
| 119 commit_to_activate_duration.Add(other.commit_to_activate_duration); | 117 commit_to_activate_duration.Add(other.commit_to_activate_duration); |
| 120 commit_to_activate_duration_estimate.Add( | 118 commit_to_activate_duration_estimate.Add( |
| 121 other.commit_to_activate_duration_estimate); | 119 other.commit_to_activate_duration_estimate); |
| 122 } | 120 } |
| 123 | 121 |
| 124 void RenderingStats::Add(const RenderingStats& other) { | 122 void RenderingStats::Add(const RenderingStats& other) { |
| 125 main_stats.Add(other.main_stats); | 123 main_stats.Add(other.main_stats); |
| 126 impl_stats.Add(other.impl_stats); | 124 impl_stats.Add(other.impl_stats); |
| 127 } | 125 } |
| 128 | 126 |
| 129 } // namespace cc | 127 } // namespace cc |
| OLD | NEW |