OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics/profiler/profiler_metrics_provider.h" | 5 #include "components/metrics/profiler/profiler_metrics_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/tracked_objects.h" | 8 #include "base/tracked_objects.h" |
9 #include "components/metrics/metrics_hashes.h" | 9 #include "components/metrics/metrics_hashes.h" |
10 #include "content/public/common/process_type.h" | 10 #include "content/public/common/process_type.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 using tracked_objects::ProcessDataSnapshot; | 13 using tracked_objects::ProcessDataPhaseSnapshot; |
14 using tracked_objects::TaskSnapshot; | 14 using tracked_objects::TaskSnapshot; |
15 | 15 |
16 namespace metrics { | 16 namespace metrics { |
17 | 17 |
18 TEST(ProfilerMetricsProviderTest, RecordData) { | 18 TEST(ProfilerMetricsProviderTest, RecordData) { |
19 // WARNING: If you broke the below check, you've modified how | 19 // WARNING: If you broke the below check, you've modified how |
20 // HashMetricName works. Please also modify all server-side code that | 20 // HashMetricName works. Please also modify all server-side code that |
21 // relies on the existing way of hashing. | 21 // relies on the existing way of hashing. |
22 EXPECT_EQ(GG_UINT64_C(1518842999910132863), HashMetricName("birth_thread*")); | 22 EXPECT_EQ(GG_UINT64_C(1518842999910132863), HashMetricName("birth_thread*")); |
23 | 23 |
24 ProfilerMetricsProvider profiler_metrics_provider; | 24 ProfilerMetricsProvider profiler_metrics_provider; |
25 | 25 |
26 { | 26 { |
27 // Add data from the browser process. | 27 // Add data from the browser process. |
28 ProcessDataSnapshot process_data; | 28 ProcessDataPhaseSnapshot process_data_phase; |
29 process_data.process_id = 177; | 29 process_data_phase.tasks.push_back(TaskSnapshot()); |
30 process_data.tasks.push_back(TaskSnapshot()); | 30 process_data_phase.tasks.back().birth.location.file_name = "a/b/file.h"; |
31 process_data.tasks.back().birth.location.file_name = "a/b/file.h"; | 31 process_data_phase.tasks.back().birth.location.function_name = "function"; |
32 process_data.tasks.back().birth.location.function_name = "function"; | 32 process_data_phase.tasks.back().birth.location.line_number = 1337; |
33 process_data.tasks.back().birth.location.line_number = 1337; | 33 process_data_phase.tasks.back().birth.thread_name = "birth_thread"; |
34 process_data.tasks.back().birth.thread_name = "birth_thread"; | 34 process_data_phase.tasks.back().death_data.count = 37; |
35 process_data.tasks.back().death_data.count = 37; | 35 process_data_phase.tasks.back().death_data.run_duration_sum = 31; |
36 process_data.tasks.back().death_data.run_duration_sum = 31; | 36 process_data_phase.tasks.back().death_data.run_duration_max = 17; |
37 process_data.tasks.back().death_data.run_duration_max = 17; | 37 process_data_phase.tasks.back().death_data.run_duration_sample = 13; |
38 process_data.tasks.back().death_data.run_duration_sample = 13; | 38 process_data_phase.tasks.back().death_data.queue_duration_sum = 8; |
39 process_data.tasks.back().death_data.queue_duration_sum = 8; | 39 process_data_phase.tasks.back().death_data.queue_duration_max = 5; |
40 process_data.tasks.back().death_data.queue_duration_max = 5; | 40 process_data_phase.tasks.back().death_data.queue_duration_sample = 3; |
41 process_data.tasks.back().death_data.queue_duration_sample = 3; | 41 process_data_phase.tasks.back().death_thread_name = "Still_Alive"; |
42 process_data.tasks.back().death_thread_name = "Still_Alive"; | 42 process_data_phase.tasks.push_back(TaskSnapshot()); |
43 process_data.tasks.push_back(TaskSnapshot()); | 43 process_data_phase.tasks.back().birth.location.file_name = "c\\d\\file2"; |
44 process_data.tasks.back().birth.location.file_name = "c\\d\\file2"; | 44 process_data_phase.tasks.back().birth.location.function_name = "function2"; |
45 process_data.tasks.back().birth.location.function_name = "function2"; | 45 process_data_phase.tasks.back().birth.location.line_number = 1773; |
46 process_data.tasks.back().birth.location.line_number = 1773; | 46 process_data_phase.tasks.back().birth.thread_name = "birth_thread2"; |
47 process_data.tasks.back().birth.thread_name = "birth_thread2"; | 47 process_data_phase.tasks.back().death_data.count = 19; |
48 process_data.tasks.back().death_data.count = 19; | 48 process_data_phase.tasks.back().death_data.run_duration_sum = 23; |
49 process_data.tasks.back().death_data.run_duration_sum = 23; | 49 process_data_phase.tasks.back().death_data.run_duration_max = 11; |
50 process_data.tasks.back().death_data.run_duration_max = 11; | 50 process_data_phase.tasks.back().death_data.run_duration_sample = 7; |
51 process_data.tasks.back().death_data.run_duration_sample = 7; | 51 process_data_phase.tasks.back().death_data.queue_duration_sum = 0; |
52 process_data.tasks.back().death_data.queue_duration_sum = 0; | 52 process_data_phase.tasks.back().death_data.queue_duration_max = 0; |
53 process_data.tasks.back().death_data.queue_duration_max = 0; | 53 process_data_phase.tasks.back().death_data.queue_duration_sample = 0; |
54 process_data.tasks.back().death_data.queue_duration_sample = 0; | 54 process_data_phase.tasks.back().death_thread_name = "death_thread"; |
55 process_data.tasks.back().death_thread_name = "death_thread"; | 55 |
56 | 56 profiler_metrics_provider.RecordProfilerData( |
57 profiler_metrics_provider.RecordProfilerData(process_data, | 57 process_data_phase, 177, content::PROCESS_TYPE_BROWSER, 0, |
58 content::PROCESS_TYPE_BROWSER); | 58 base::TimeDelta::FromMinutes(1), base::TimeDelta::FromMinutes(2), |
| 59 ProfilerEvents()); |
| 60 } |
| 61 |
| 62 { |
| 63 // Add second phase from the browser process. |
| 64 ProcessDataPhaseSnapshot process_data_phase; |
| 65 process_data_phase.tasks.push_back(TaskSnapshot()); |
| 66 process_data_phase.tasks.back().birth.location.file_name = "a/b/file10.h"; |
| 67 process_data_phase.tasks.back().birth.location.function_name = "function10"; |
| 68 process_data_phase.tasks.back().birth.location.line_number = 101337; |
| 69 process_data_phase.tasks.back().birth.thread_name = "birth_thread_ten"; |
| 70 process_data_phase.tasks.back().death_data.count = 1037; |
| 71 process_data_phase.tasks.back().death_data.run_duration_sum = 1031; |
| 72 process_data_phase.tasks.back().death_data.run_duration_max = 1017; |
| 73 process_data_phase.tasks.back().death_data.run_duration_sample = 1013; |
| 74 process_data_phase.tasks.back().death_data.queue_duration_sum = 108; |
| 75 process_data_phase.tasks.back().death_data.queue_duration_max = 105; |
| 76 process_data_phase.tasks.back().death_data.queue_duration_sample = 103; |
| 77 process_data_phase.tasks.back().death_thread_name = "Already_Dead"; |
| 78 process_data_phase.tasks.push_back(TaskSnapshot()); |
| 79 process_data_phase.tasks.back().birth.location.file_name = "c\\d\\file210"; |
| 80 process_data_phase.tasks.back().birth.location.function_name = |
| 81 "function210"; |
| 82 process_data_phase.tasks.back().birth.location.line_number = 101773; |
| 83 process_data_phase.tasks.back().birth.thread_name = "birth_thread_ten2"; |
| 84 process_data_phase.tasks.back().death_data.count = 1019; |
| 85 process_data_phase.tasks.back().death_data.run_duration_sum = 1023; |
| 86 process_data_phase.tasks.back().death_data.run_duration_max = 1011; |
| 87 process_data_phase.tasks.back().death_data.run_duration_sample = 107; |
| 88 process_data_phase.tasks.back().death_data.queue_duration_sum = 100; |
| 89 process_data_phase.tasks.back().death_data.queue_duration_max = 100; |
| 90 process_data_phase.tasks.back().death_data.queue_duration_sample = 100; |
| 91 process_data_phase.tasks.back().death_thread_name = "death_thread_ten"; |
| 92 |
| 93 profiler_metrics_provider.RecordProfilerData( |
| 94 process_data_phase, 177, content::PROCESS_TYPE_BROWSER, 1, |
| 95 base::TimeDelta::FromMinutes(10), base::TimeDelta::FromMinutes(20), |
| 96 ProfilerEvents(1, ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT)); |
59 } | 97 } |
60 | 98 |
61 { | 99 { |
62 // Add data from a renderer process. | 100 // Add data from a renderer process. |
63 ProcessDataSnapshot process_data; | 101 ProcessDataPhaseSnapshot process_data_phase; |
64 process_data.process_id = 1177; | 102 process_data_phase.tasks.push_back(TaskSnapshot()); |
65 process_data.tasks.push_back(TaskSnapshot()); | 103 process_data_phase.tasks.back().birth.location.file_name = "file3"; |
66 process_data.tasks.back().birth.location.file_name = "file3"; | 104 process_data_phase.tasks.back().birth.location.function_name = "function3"; |
67 process_data.tasks.back().birth.location.function_name = "function3"; | 105 process_data_phase.tasks.back().birth.location.line_number = 7331; |
68 process_data.tasks.back().birth.location.line_number = 7331; | 106 process_data_phase.tasks.back().birth.thread_name = "birth_thread3"; |
69 process_data.tasks.back().birth.thread_name = "birth_thread3"; | 107 process_data_phase.tasks.back().death_data.count = 137; |
70 process_data.tasks.back().death_data.count = 137; | 108 process_data_phase.tasks.back().death_data.run_duration_sum = 131; |
71 process_data.tasks.back().death_data.run_duration_sum = 131; | 109 process_data_phase.tasks.back().death_data.run_duration_max = 117; |
72 process_data.tasks.back().death_data.run_duration_max = 117; | 110 process_data_phase.tasks.back().death_data.run_duration_sample = 113; |
73 process_data.tasks.back().death_data.run_duration_sample = 113; | 111 process_data_phase.tasks.back().death_data.queue_duration_sum = 108; |
74 process_data.tasks.back().death_data.queue_duration_sum = 108; | 112 process_data_phase.tasks.back().death_data.queue_duration_max = 105; |
75 process_data.tasks.back().death_data.queue_duration_max = 105; | 113 process_data_phase.tasks.back().death_data.queue_duration_sample = 103; |
76 process_data.tasks.back().death_data.queue_duration_sample = 103; | 114 process_data_phase.tasks.back().death_thread_name = "death_thread3"; |
77 process_data.tasks.back().death_thread_name = "death_thread3"; | 115 process_data_phase.tasks.push_back(TaskSnapshot()); |
78 process_data.tasks.push_back(TaskSnapshot()); | 116 process_data_phase.tasks.back().birth.location.file_name = ""; |
79 process_data.tasks.back().birth.location.file_name = ""; | 117 process_data_phase.tasks.back().birth.location.function_name = ""; |
80 process_data.tasks.back().birth.location.function_name = ""; | 118 process_data_phase.tasks.back().birth.location.line_number = 7332; |
81 process_data.tasks.back().birth.location.line_number = 7332; | 119 process_data_phase.tasks.back().birth.thread_name = ""; |
82 process_data.tasks.back().birth.thread_name = ""; | 120 process_data_phase.tasks.back().death_data.count = 138; |
83 process_data.tasks.back().death_data.count = 138; | 121 process_data_phase.tasks.back().death_data.run_duration_sum = 132; |
84 process_data.tasks.back().death_data.run_duration_sum = 132; | 122 process_data_phase.tasks.back().death_data.run_duration_max = 118; |
85 process_data.tasks.back().death_data.run_duration_max = 118; | 123 process_data_phase.tasks.back().death_data.run_duration_sample = 114; |
86 process_data.tasks.back().death_data.run_duration_sample = 114; | 124 process_data_phase.tasks.back().death_data.queue_duration_sum = 109; |
87 process_data.tasks.back().death_data.queue_duration_sum = 109; | 125 process_data_phase.tasks.back().death_data.queue_duration_max = 106; |
88 process_data.tasks.back().death_data.queue_duration_max = 106; | 126 process_data_phase.tasks.back().death_data.queue_duration_sample = 104; |
89 process_data.tasks.back().death_data.queue_duration_sample = 104; | 127 process_data_phase.tasks.back().death_thread_name = ""; |
90 process_data.tasks.back().death_thread_name = ""; | |
91 | 128 |
92 profiler_metrics_provider.RecordProfilerData( | 129 profiler_metrics_provider.RecordProfilerData( |
93 process_data, content::PROCESS_TYPE_RENDERER); | 130 process_data_phase, 1177, content::PROCESS_TYPE_RENDERER, 0, |
94 | 131 base::TimeDelta::FromMinutes(1), base::TimeDelta::FromMinutes(2), |
95 // Capture the data and verify that it is as expected. | 132 ProfilerEvents()); |
96 ChromeUserMetricsExtension uma_proto; | |
97 profiler_metrics_provider.ProvideGeneralMetrics(&uma_proto); | |
98 | |
99 ASSERT_EQ(1, uma_proto.profiler_event_size()); | |
100 EXPECT_EQ(ProfilerEventProto::VERSION_STARTUP_PROFILE, | |
101 uma_proto.profiler_event(0).profile_version()); | |
102 EXPECT_EQ(ProfilerEventProto::WALL_CLOCK_TIME, | |
103 uma_proto.profiler_event(0).time_source()); | |
104 ASSERT_EQ(4, uma_proto.profiler_event(0).tracked_object_size()); | |
105 | |
106 const ProfilerEventProto::TrackedObject* tracked_object = | |
107 &uma_proto.profiler_event(0).tracked_object(0); | |
108 EXPECT_EQ(HashMetricName("file.h"), | |
109 tracked_object->source_file_name_hash()); | |
110 EXPECT_EQ(HashMetricName("function"), | |
111 tracked_object->source_function_name_hash()); | |
112 EXPECT_EQ(1337, tracked_object->source_line_number()); | |
113 EXPECT_EQ(HashMetricName("birth_thread"), | |
114 tracked_object->birth_thread_name_hash()); | |
115 EXPECT_EQ(37, tracked_object->exec_count()); | |
116 EXPECT_EQ(31, tracked_object->exec_time_total()); | |
117 EXPECT_EQ(13, tracked_object->exec_time_sampled()); | |
118 EXPECT_EQ(8, tracked_object->queue_time_total()); | |
119 EXPECT_EQ(3, tracked_object->queue_time_sampled()); | |
120 EXPECT_EQ(HashMetricName("Still_Alive"), | |
121 tracked_object->exec_thread_name_hash()); | |
122 EXPECT_EQ(177U, tracked_object->process_id()); | |
123 EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER, | |
124 tracked_object->process_type()); | |
125 | |
126 tracked_object = &uma_proto.profiler_event(0).tracked_object(1); | |
127 EXPECT_EQ(HashMetricName("file2"), | |
128 tracked_object->source_file_name_hash()); | |
129 EXPECT_EQ(HashMetricName("function2"), | |
130 tracked_object->source_function_name_hash()); | |
131 EXPECT_EQ(1773, tracked_object->source_line_number()); | |
132 EXPECT_EQ(HashMetricName("birth_thread*"), | |
133 tracked_object->birth_thread_name_hash()); | |
134 EXPECT_EQ(19, tracked_object->exec_count()); | |
135 EXPECT_EQ(23, tracked_object->exec_time_total()); | |
136 EXPECT_EQ(7, tracked_object->exec_time_sampled()); | |
137 EXPECT_EQ(0, tracked_object->queue_time_total()); | |
138 EXPECT_EQ(0, tracked_object->queue_time_sampled()); | |
139 EXPECT_EQ(HashMetricName("death_thread"), | |
140 tracked_object->exec_thread_name_hash()); | |
141 EXPECT_EQ(177U, tracked_object->process_id()); | |
142 EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER, | |
143 tracked_object->process_type()); | |
144 | |
145 tracked_object = &uma_proto.profiler_event(0).tracked_object(2); | |
146 EXPECT_EQ(HashMetricName("file3"), | |
147 tracked_object->source_file_name_hash()); | |
148 EXPECT_EQ(HashMetricName("function3"), | |
149 tracked_object->source_function_name_hash()); | |
150 EXPECT_EQ(7331, tracked_object->source_line_number()); | |
151 EXPECT_EQ(HashMetricName("birth_thread*"), | |
152 tracked_object->birth_thread_name_hash()); | |
153 EXPECT_EQ(137, tracked_object->exec_count()); | |
154 EXPECT_EQ(131, tracked_object->exec_time_total()); | |
155 EXPECT_EQ(113, tracked_object->exec_time_sampled()); | |
156 EXPECT_EQ(108, tracked_object->queue_time_total()); | |
157 EXPECT_EQ(103, tracked_object->queue_time_sampled()); | |
158 EXPECT_EQ(HashMetricName("death_thread*"), | |
159 tracked_object->exec_thread_name_hash()); | |
160 EXPECT_EQ(1177U, tracked_object->process_id()); | |
161 EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER, | |
162 tracked_object->process_type()); | |
163 | |
164 tracked_object = &uma_proto.profiler_event(0).tracked_object(3); | |
165 EXPECT_EQ(HashMetricName(""), | |
166 tracked_object->source_file_name_hash()); | |
167 EXPECT_EQ(HashMetricName(""), | |
168 tracked_object->source_function_name_hash()); | |
169 EXPECT_EQ(7332, tracked_object->source_line_number()); | |
170 EXPECT_EQ(HashMetricName(""), | |
171 tracked_object->birth_thread_name_hash()); | |
172 EXPECT_EQ(138, tracked_object->exec_count()); | |
173 EXPECT_EQ(132, tracked_object->exec_time_total()); | |
174 EXPECT_EQ(114, tracked_object->exec_time_sampled()); | |
175 EXPECT_EQ(109, tracked_object->queue_time_total()); | |
176 EXPECT_EQ(104, tracked_object->queue_time_sampled()); | |
177 EXPECT_EQ(HashMetricName(""), | |
178 tracked_object->exec_thread_name_hash()); | |
179 EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER, | |
180 tracked_object->process_type()); | |
181 } | 133 } |
| 134 |
| 135 // Capture the data and verify that it is as expected. |
| 136 ChromeUserMetricsExtension uma_proto; |
| 137 profiler_metrics_provider.ProvideGeneralMetrics(&uma_proto); |
| 138 |
| 139 // Phase 0 |
| 140 ASSERT_EQ(2, uma_proto.profiler_event_size()); |
| 141 |
| 142 EXPECT_EQ(ProfilerEventProto::VERSION_SPLIT_PROFILE, |
| 143 uma_proto.profiler_event(0).profile_version()); |
| 144 EXPECT_EQ(ProfilerEventProto::WALL_CLOCK_TIME, |
| 145 uma_proto.profiler_event(0).time_source()); |
| 146 ASSERT_EQ(0, uma_proto.profiler_event(0).past_session_event_size()); |
| 147 ASSERT_EQ(60000, uma_proto.profiler_event(0).profiling_start_ms()); |
| 148 ASSERT_EQ(120000, uma_proto.profiler_event(0).profiling_finish_ms()); |
| 149 ASSERT_EQ(4, uma_proto.profiler_event(0).tracked_object_size()); |
| 150 |
| 151 const ProfilerEventProto::TrackedObject* tracked_object = |
| 152 &uma_proto.profiler_event(0).tracked_object(0); |
| 153 EXPECT_EQ(HashMetricName("file.h"), tracked_object->source_file_name_hash()); |
| 154 EXPECT_EQ(HashMetricName("function"), |
| 155 tracked_object->source_function_name_hash()); |
| 156 EXPECT_EQ(1337, tracked_object->source_line_number()); |
| 157 EXPECT_EQ(HashMetricName("birth_thread"), |
| 158 tracked_object->birth_thread_name_hash()); |
| 159 EXPECT_EQ(37, tracked_object->exec_count()); |
| 160 EXPECT_EQ(31, tracked_object->exec_time_total()); |
| 161 EXPECT_EQ(13, tracked_object->exec_time_sampled()); |
| 162 EXPECT_EQ(8, tracked_object->queue_time_total()); |
| 163 EXPECT_EQ(3, tracked_object->queue_time_sampled()); |
| 164 EXPECT_EQ(HashMetricName("Still_Alive"), |
| 165 tracked_object->exec_thread_name_hash()); |
| 166 EXPECT_EQ(177U, tracked_object->process_id()); |
| 167 EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER, |
| 168 tracked_object->process_type()); |
| 169 |
| 170 tracked_object = &uma_proto.profiler_event(0).tracked_object(1); |
| 171 EXPECT_EQ(HashMetricName("file2"), tracked_object->source_file_name_hash()); |
| 172 EXPECT_EQ(HashMetricName("function2"), |
| 173 tracked_object->source_function_name_hash()); |
| 174 EXPECT_EQ(1773, tracked_object->source_line_number()); |
| 175 EXPECT_EQ(HashMetricName("birth_thread*"), |
| 176 tracked_object->birth_thread_name_hash()); |
| 177 EXPECT_EQ(19, tracked_object->exec_count()); |
| 178 EXPECT_EQ(23, tracked_object->exec_time_total()); |
| 179 EXPECT_EQ(7, tracked_object->exec_time_sampled()); |
| 180 EXPECT_EQ(0, tracked_object->queue_time_total()); |
| 181 EXPECT_EQ(0, tracked_object->queue_time_sampled()); |
| 182 EXPECT_EQ(HashMetricName("death_thread"), |
| 183 tracked_object->exec_thread_name_hash()); |
| 184 EXPECT_EQ(177U, tracked_object->process_id()); |
| 185 EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER, |
| 186 tracked_object->process_type()); |
| 187 |
| 188 tracked_object = &uma_proto.profiler_event(0).tracked_object(2); |
| 189 EXPECT_EQ(HashMetricName("file3"), tracked_object->source_file_name_hash()); |
| 190 EXPECT_EQ(HashMetricName("function3"), |
| 191 tracked_object->source_function_name_hash()); |
| 192 EXPECT_EQ(7331, tracked_object->source_line_number()); |
| 193 EXPECT_EQ(HashMetricName("birth_thread*"), |
| 194 tracked_object->birth_thread_name_hash()); |
| 195 EXPECT_EQ(137, tracked_object->exec_count()); |
| 196 EXPECT_EQ(131, tracked_object->exec_time_total()); |
| 197 EXPECT_EQ(113, tracked_object->exec_time_sampled()); |
| 198 EXPECT_EQ(108, tracked_object->queue_time_total()); |
| 199 EXPECT_EQ(103, tracked_object->queue_time_sampled()); |
| 200 EXPECT_EQ(HashMetricName("death_thread*"), |
| 201 tracked_object->exec_thread_name_hash()); |
| 202 EXPECT_EQ(1177U, tracked_object->process_id()); |
| 203 EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER, |
| 204 tracked_object->process_type()); |
| 205 |
| 206 tracked_object = &uma_proto.profiler_event(0).tracked_object(3); |
| 207 EXPECT_EQ(HashMetricName(""), tracked_object->source_file_name_hash()); |
| 208 EXPECT_EQ(HashMetricName(""), tracked_object->source_function_name_hash()); |
| 209 EXPECT_EQ(7332, tracked_object->source_line_number()); |
| 210 EXPECT_EQ(HashMetricName(""), tracked_object->birth_thread_name_hash()); |
| 211 EXPECT_EQ(138, tracked_object->exec_count()); |
| 212 EXPECT_EQ(132, tracked_object->exec_time_total()); |
| 213 EXPECT_EQ(114, tracked_object->exec_time_sampled()); |
| 214 EXPECT_EQ(109, tracked_object->queue_time_total()); |
| 215 EXPECT_EQ(104, tracked_object->queue_time_sampled()); |
| 216 EXPECT_EQ(HashMetricName(""), tracked_object->exec_thread_name_hash()); |
| 217 EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER, |
| 218 tracked_object->process_type()); |
| 219 |
| 220 // Phase 1 |
| 221 EXPECT_EQ(ProfilerEventProto::VERSION_SPLIT_PROFILE, |
| 222 uma_proto.profiler_event(1).profile_version()); |
| 223 EXPECT_EQ(ProfilerEventProto::WALL_CLOCK_TIME, |
| 224 uma_proto.profiler_event(1).time_source()); |
| 225 ASSERT_EQ(1, uma_proto.profiler_event(1).past_session_event_size()); |
| 226 ASSERT_EQ(ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT, |
| 227 uma_proto.profiler_event(1).past_session_event(0)); |
| 228 ASSERT_EQ(600000, uma_proto.profiler_event(1).profiling_start_ms()); |
| 229 ASSERT_EQ(1200000, uma_proto.profiler_event(1).profiling_finish_ms()); |
| 230 ASSERT_EQ(2, uma_proto.profiler_event(1).tracked_object_size()); |
| 231 |
| 232 tracked_object = &uma_proto.profiler_event(1).tracked_object(0); |
| 233 EXPECT_EQ(HashMetricName("file10.h"), |
| 234 tracked_object->source_file_name_hash()); |
| 235 EXPECT_EQ(HashMetricName("function10"), |
| 236 tracked_object->source_function_name_hash()); |
| 237 EXPECT_EQ(101337, tracked_object->source_line_number()); |
| 238 EXPECT_EQ(HashMetricName("birth_thread_ten"), |
| 239 tracked_object->birth_thread_name_hash()); |
| 240 EXPECT_EQ(1037, tracked_object->exec_count()); |
| 241 EXPECT_EQ(1031, tracked_object->exec_time_total()); |
| 242 EXPECT_EQ(1013, tracked_object->exec_time_sampled()); |
| 243 EXPECT_EQ(108, tracked_object->queue_time_total()); |
| 244 EXPECT_EQ(103, tracked_object->queue_time_sampled()); |
| 245 EXPECT_EQ(HashMetricName("Already_Dead"), |
| 246 tracked_object->exec_thread_name_hash()); |
| 247 EXPECT_EQ(177U, tracked_object->process_id()); |
| 248 EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER, |
| 249 tracked_object->process_type()); |
| 250 |
| 251 tracked_object = &uma_proto.profiler_event(1).tracked_object(1); |
| 252 EXPECT_EQ(HashMetricName("file210"), tracked_object->source_file_name_hash()); |
| 253 EXPECT_EQ(HashMetricName("function210"), |
| 254 tracked_object->source_function_name_hash()); |
| 255 EXPECT_EQ(101773, tracked_object->source_line_number()); |
| 256 EXPECT_EQ(HashMetricName("birth_thread_ten*"), |
| 257 tracked_object->birth_thread_name_hash()); |
| 258 EXPECT_EQ(1019, tracked_object->exec_count()); |
| 259 EXPECT_EQ(1023, tracked_object->exec_time_total()); |
| 260 EXPECT_EQ(107, tracked_object->exec_time_sampled()); |
| 261 EXPECT_EQ(100, tracked_object->queue_time_total()); |
| 262 EXPECT_EQ(100, tracked_object->queue_time_sampled()); |
| 263 EXPECT_EQ(HashMetricName("death_thread_ten"), |
| 264 tracked_object->exec_thread_name_hash()); |
| 265 EXPECT_EQ(177U, tracked_object->process_id()); |
| 266 EXPECT_EQ(ProfilerEventProto::TrackedObject::BROWSER, |
| 267 tracked_object->process_type()); |
182 } | 268 } |
183 | 269 |
184 } // namespace metrics | 270 } // namespace metrics |
OLD | NEW |