1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/debug/rendering_stats.h"
namespace cc {
RenderingStats::TimeDeltaList::TimeDeltaList() {
}
RenderingStats::TimeDeltaList::~TimeDeltaList() {
}
void RenderingStats::TimeDeltaList::Append(base::TimeDelta value) {
values.push_back(value);
}
void RenderingStats::TimeDeltaList::AddToTracedValue(
const char* name,
base::trace_event::TracedValue* list_value) const {
list_value->BeginArray(name);
for (const auto& value : values) {
list_value->AppendDouble(value.InMillisecondsF());
}
list_value->EndArray();
}
void RenderingStats::TimeDeltaList::Add(const TimeDeltaList& other) {
values.insert(values.end(), other.values.begin(), other.values.end());
}
base::TimeDelta RenderingStats::TimeDeltaList::GetLastTimeDelta() const {
return values.empty() ? base::TimeDelta() : values.back();
}
RenderingStats::RenderingStats()
: frame_count(0),
visible_content_area(0),
approximated_visible_content_area(0),
checkerboarded_visible_content_area(0) {
}
RenderingStats::~RenderingStats() {
}
scoped_refptr<base::trace_event::ConvertableToTraceFormat>
RenderingStats::AsTraceableData() const {
scoped_refptr<base::trace_event::TracedValue> record_data =
new base::trace_event::TracedValue();
record_data->SetInteger("frame_count", frame_count);
record_data->SetInteger("visible_content_area", visible_content_area);
record_data->SetInteger("approximated_visible_content_area",
approximated_visible_content_area);
record_data->SetInteger("checkerboarded_visible_content_area",
checkerboarded_visible_content_area);
draw_duration.AddToTracedValue("draw_duration_ms", record_data.get());
draw_duration_estimate.AddToTracedValue("draw_duration_estimate_ms",
record_data.get());
begin_main_frame_to_commit_duration.AddToTracedValue(
"begin_main_frame_to_commit_duration_ms", record_data.get());
begin_main_frame_to_commit_duration_estimate.AddToTracedValue(
"begin_main_frame_to_commit_duration_estimate_ms", record_data.get());
commit_to_activate_duration.AddToTracedValue("commit_to_activate_duration_ms",
record_data.get());
commit_to_activate_duration_estimate.AddToTracedValue(
"commit_to_activate_duration_estimate_ms", record_data.get());
return record_data;
}
void RenderingStats::Add(const RenderingStats& other) {
frame_count += other.frame_count;
visible_content_area += other.visible_content_area;
approximated_visible_content_area += other.approximated_visible_content_area;
checkerboarded_visible_content_area +=
other.checkerboarded_visible_content_area;
draw_duration.Add(other.draw_duration);
draw_duration_estimate.Add(other.draw_duration_estimate);
begin_main_frame_to_commit_duration.Add(
other.begin_main_frame_to_commit_duration);
begin_main_frame_to_commit_duration_estimate.Add(
other.begin_main_frame_to_commit_duration_estimate);
commit_to_activate_duration.Add(other.commit_to_activate_duration);
commit_to_activate_duration_estimate.Add(
other.commit_to_activate_duration_estimate);
}
} // namespace cc
|