Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: base/tracked_objects_unittest.cc

Issue 1021053003: Delivering the FIRST_NONEMPTY_PAINT phase changing event to base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@phase_splitting
Patch Set: Evehn more isherman@ comments. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // Test of classes in the tracked_objects.h classes. 5 // Test of classes in the tracked_objects.h classes.
6 6
7 #include "base/tracked_objects.h" 7 #include "base/tracked_objects.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Test time in milliseconds. 116 // Test time in milliseconds.
117 static unsigned int test_time_; 117 static unsigned int test_time_;
118 }; 118 };
119 119
120 // static 120 // static
121 unsigned int TrackedObjectsTest::test_time_; 121 unsigned int TrackedObjectsTest::test_time_;
122 122
123 TEST_F(TrackedObjectsTest, TaskStopwatchNoStartStop) { 123 TEST_F(TrackedObjectsTest, TaskStopwatchNoStartStop) {
124 if (!ThreadData::InitializeAndSetTrackingStatus( 124 if (!ThreadData::InitializeAndSetTrackingStatus(
125 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 125 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
126 // Don't run the test if task tracking is not compiled in.
126 return; 127 return;
127 } 128 }
128 129
129 // Check that creating and destroying a stopwatch without starting it doesn't 130 // Check that creating and destroying a stopwatch without starting it doesn't
130 // crash. 131 // crash.
131 TaskStopwatch stopwatch; 132 TaskStopwatch stopwatch;
132 } 133 }
133 134
134 TEST_F(TrackedObjectsTest, MinimalStartupShutdown) { 135 TEST_F(TrackedObjectsTest, MinimalStartupShutdown) {
135 // Minimal test doesn't even create any tasks. 136 // Minimal test doesn't even create any tasks.
136 if (!ThreadData::InitializeAndSetTrackingStatus( 137 if (!ThreadData::InitializeAndSetTrackingStatus(
137 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 138 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
139 // Don't run the test if task tracking is not compiled in.
138 return; 140 return;
139 } 141 }
140 142
141 EXPECT_FALSE(ThreadData::first()); // No activity even on this thread. 143 EXPECT_FALSE(ThreadData::first()); // No activity even on this thread.
142 ThreadData* data = ThreadData::Get(); 144 ThreadData* data = ThreadData::Get();
143 EXPECT_TRUE(ThreadData::first()); // Now class was constructed. 145 EXPECT_TRUE(ThreadData::first()); // Now class was constructed.
144 ASSERT_TRUE(data); 146 ASSERT_TRUE(data);
145 EXPECT_FALSE(data->next()); 147 EXPECT_FALSE(data->next());
146 EXPECT_EQ(data, ThreadData::Get()); 148 EXPECT_EQ(data, ThreadData::Get());
147 ThreadData::BirthMap birth_map; 149 ThreadData::BirthMap birth_map;
148 ThreadData::DeathMap death_map; 150 ThreadData::DeathsSnapshot deaths;
149 ThreadData::ParentChildSet parent_child_set; 151 ThreadData::ParentChildSet parent_child_set;
150 data->SnapshotMaps(&birth_map, &death_map, &parent_child_set); 152 data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
151 EXPECT_EQ(0u, birth_map.size()); 153 EXPECT_EQ(0u, birth_map.size());
152 EXPECT_EQ(0u, death_map.size()); 154 EXPECT_EQ(0u, deaths.size());
153 EXPECT_EQ(0u, parent_child_set.size()); 155 EXPECT_EQ(0u, parent_child_set.size());
154 156
155 // Clean up with no leaking. 157 // Clean up with no leaking.
156 Reset(); 158 Reset();
157 159
158 // Do it again, just to be sure we reset state completely. 160 // Do it again, just to be sure we reset state completely.
159 EXPECT_TRUE(ThreadData::InitializeAndSetTrackingStatus( 161 EXPECT_TRUE(ThreadData::InitializeAndSetTrackingStatus(
160 ThreadData::PROFILING_CHILDREN_ACTIVE)); 162 ThreadData::PROFILING_CHILDREN_ACTIVE));
161 EXPECT_FALSE(ThreadData::first()); // No activity even on this thread. 163 EXPECT_FALSE(ThreadData::first()); // No activity even on this thread.
162 data = ThreadData::Get(); 164 data = ThreadData::Get();
163 EXPECT_TRUE(ThreadData::first()); // Now class was constructed. 165 EXPECT_TRUE(ThreadData::first()); // Now class was constructed.
164 ASSERT_TRUE(data); 166 ASSERT_TRUE(data);
165 EXPECT_FALSE(data->next()); 167 EXPECT_FALSE(data->next());
166 EXPECT_EQ(data, ThreadData::Get()); 168 EXPECT_EQ(data, ThreadData::Get());
167 birth_map.clear(); 169 birth_map.clear();
168 death_map.clear(); 170 deaths.clear();
169 parent_child_set.clear(); 171 parent_child_set.clear();
170 data->SnapshotMaps(&birth_map, &death_map, &parent_child_set); 172 data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
171 EXPECT_EQ(0u, birth_map.size()); 173 EXPECT_EQ(0u, birth_map.size());
172 EXPECT_EQ(0u, death_map.size()); 174 EXPECT_EQ(0u, deaths.size());
173 EXPECT_EQ(0u, parent_child_set.size()); 175 EXPECT_EQ(0u, parent_child_set.size());
174 } 176 }
175 177
176 TEST_F(TrackedObjectsTest, TinyStartupShutdown) { 178 TEST_F(TrackedObjectsTest, TinyStartupShutdown) {
177 if (!ThreadData::InitializeAndSetTrackingStatus( 179 if (!ThreadData::InitializeAndSetTrackingStatus(
178 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 180 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
181 // Don't run the test if task tracking is not compiled in.
179 return; 182 return;
180 } 183 }
181 184
182 // Instigate tracking on a single tracked object, on our thread. 185 // Instigate tracking on a single tracked object, on our thread.
183 const char kFunction[] = "TinyStartupShutdown"; 186 const char kFunction[] = "TinyStartupShutdown";
184 Location location(kFunction, kFile, kLineNumber, NULL); 187 Location location(kFunction, kFile, kLineNumber, NULL);
185 Births* first_birth = ThreadData::TallyABirthIfActive(location); 188 Births* first_birth = ThreadData::TallyABirthIfActive(location);
186 189
187 ThreadData* data = ThreadData::first(); 190 ThreadData* data = ThreadData::first();
188 ASSERT_TRUE(data); 191 ASSERT_TRUE(data);
189 EXPECT_FALSE(data->next()); 192 EXPECT_FALSE(data->next());
190 EXPECT_EQ(data, ThreadData::Get()); 193 EXPECT_EQ(data, ThreadData::Get());
191 ThreadData::BirthMap birth_map; 194 ThreadData::BirthMap birth_map;
192 ThreadData::DeathMap death_map; 195 ThreadData::DeathsSnapshot deaths;
193 ThreadData::ParentChildSet parent_child_set; 196 ThreadData::ParentChildSet parent_child_set;
194 data->SnapshotMaps(&birth_map, &death_map, &parent_child_set); 197 data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
195 EXPECT_EQ(1u, birth_map.size()); // 1 birth location. 198 EXPECT_EQ(1u, birth_map.size()); // 1 birth location.
196 EXPECT_EQ(1, birth_map.begin()->second->birth_count()); // 1 birth. 199 EXPECT_EQ(1, birth_map.begin()->second->birth_count()); // 1 birth.
197 EXPECT_EQ(0u, death_map.size()); // No deaths. 200 EXPECT_EQ(0u, deaths.size()); // No deaths.
198 EXPECT_EQ(0u, parent_child_set.size()); // No children. 201 EXPECT_EQ(0u, parent_child_set.size()); // No children.
199 202
200 203
201 // Now instigate another birth, while we are timing the run of the first 204 // Now instigate another birth, while we are timing the run of the first
202 // execution. 205 // execution.
203 ThreadData::PrepareForStartOfRun(first_birth); 206 ThreadData::PrepareForStartOfRun(first_birth);
204 // Create a child (using the same birth location). 207 // Create a child (using the same birth location).
205 // TrackingInfo will call TallyABirth() during construction. 208 // TrackingInfo will call TallyABirth() during construction.
206 const int32 start_time = 1; 209 const int32 start_time = 1;
207 base::TimeTicks kBogusBirthTime = base::TimeTicks() + 210 base::TimeTicks kBogusBirthTime = base::TimeTicks() +
208 base::TimeDelta::FromMilliseconds(start_time); 211 base::TimeDelta::FromMilliseconds(start_time);
209 base::TrackingInfo pending_task(location, kBogusBirthTime); 212 base::TrackingInfo pending_task(location, kBogusBirthTime);
210 SetTestTime(1); 213 SetTestTime(1);
211 TaskStopwatch stopwatch; 214 TaskStopwatch stopwatch;
212 stopwatch.Start(); 215 stopwatch.Start();
213 // Finally conclude the outer run. 216 // Finally conclude the outer run.
214 const int32 time_elapsed = 1000; 217 const int32 time_elapsed = 1000;
215 SetTestTime(start_time + time_elapsed); 218 SetTestTime(start_time + time_elapsed);
216 stopwatch.Stop(); 219 stopwatch.Stop();
217 220
218 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch); 221 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
219 222
220 birth_map.clear(); 223 birth_map.clear();
221 death_map.clear(); 224 deaths.clear();
222 parent_child_set.clear(); 225 parent_child_set.clear();
223 data->SnapshotMaps(&birth_map, &death_map, &parent_child_set); 226 data->SnapshotMaps(0, &birth_map, &deaths, &parent_child_set);
224 EXPECT_EQ(1u, birth_map.size()); // 1 birth location. 227 EXPECT_EQ(1u, birth_map.size()); // 1 birth location.
225 EXPECT_EQ(2, birth_map.begin()->second->birth_count()); // 2 births. 228 EXPECT_EQ(2, birth_map.begin()->second->birth_count()); // 2 births.
226 EXPECT_EQ(1u, death_map.size()); // 1 location. 229 EXPECT_EQ(1u, deaths.size()); // 1 location.
227 EXPECT_EQ(1, death_map.begin()->second.count()); // 1 death. 230 EXPECT_EQ(1, deaths.begin()->second.death_data.count); // 1 death.
228 if (ThreadData::TrackingParentChildStatus()) { 231 if (ThreadData::TrackingParentChildStatus()) {
229 EXPECT_EQ(1u, parent_child_set.size()); // 1 child. 232 EXPECT_EQ(1u, parent_child_set.size()); // 1 child.
230 EXPECT_EQ(parent_child_set.begin()->first, 233 EXPECT_EQ(parent_child_set.begin()->first,
231 parent_child_set.begin()->second); 234 parent_child_set.begin()->second);
232 } else { 235 } else {
233 EXPECT_EQ(0u, parent_child_set.size()); // no stats. 236 EXPECT_EQ(0u, parent_child_set.size()); // no stats.
234 } 237 }
235 238
236 // The births were at the same location as the one known death. 239 // The births were at the same location as the one known death.
237 EXPECT_EQ(birth_map.begin()->second, death_map.begin()->first); 240 EXPECT_EQ(birth_map.begin()->second, deaths.begin()->first);
238 241
239 ProcessDataSnapshot process_data; 242 ProcessDataSnapshot process_data;
240 ThreadData::Snapshot(&process_data); 243 ThreadData::Snapshot(0, &process_data);
241 244
242 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size()); 245 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size());
243 auto it = process_data.phased_process_data_snapshots.find(0); 246 auto it = process_data.phased_process_data_snapshots.find(0);
244 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end()); 247 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end());
245 const ProcessDataPhaseSnapshot& process_data_phase = it->second; 248 const ProcessDataPhaseSnapshot& process_data_phase = it->second;
246 ASSERT_EQ(1u, process_data_phase.tasks.size()); 249 ASSERT_EQ(1u, process_data_phase.tasks.size());
247 EXPECT_EQ(kFile, process_data_phase.tasks[0].birth.location.file_name); 250 EXPECT_EQ(kFile, process_data_phase.tasks[0].birth.location.file_name);
248 EXPECT_EQ(kFunction, 251 EXPECT_EQ(kFunction,
249 process_data_phase.tasks[0].birth.location.function_name); 252 process_data_phase.tasks[0].birth.location.function_name);
250 EXPECT_EQ(kLineNumber, 253 EXPECT_EQ(kLineNumber,
(...skipping 30 matching lines...) Expand all
281 EXPECT_EQ(kWorkerThreadName, 284 EXPECT_EQ(kWorkerThreadName,
282 process_data_phase.descendants[0].child.thread_name); 285 process_data_phase.descendants[0].child.thread_name);
283 } else { 286 } else {
284 EXPECT_EQ(0u, process_data_phase.descendants.size()); 287 EXPECT_EQ(0u, process_data_phase.descendants.size());
285 } 288 }
286 } 289 }
287 290
288 TEST_F(TrackedObjectsTest, DeathDataTest) { 291 TEST_F(TrackedObjectsTest, DeathDataTest) {
289 if (!ThreadData::InitializeAndSetTrackingStatus( 292 if (!ThreadData::InitializeAndSetTrackingStatus(
290 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 293 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
294 // Don't run the test if task tracking is not compiled in.
291 return; 295 return;
292 } 296 }
293 297
294 scoped_ptr<DeathData> data(new DeathData()); 298 scoped_ptr<DeathData> data(new DeathData());
295 ASSERT_NE(data, reinterpret_cast<DeathData*>(NULL)); 299 ASSERT_NE(data, reinterpret_cast<DeathData*>(NULL));
296 EXPECT_EQ(data->run_duration_sum(), 0); 300 EXPECT_EQ(data->run_duration_sum(), 0);
301 EXPECT_EQ(data->run_duration_max(), 0);
297 EXPECT_EQ(data->run_duration_sample(), 0); 302 EXPECT_EQ(data->run_duration_sample(), 0);
298 EXPECT_EQ(data->queue_duration_sum(), 0); 303 EXPECT_EQ(data->queue_duration_sum(), 0);
304 EXPECT_EQ(data->queue_duration_max(), 0);
299 EXPECT_EQ(data->queue_duration_sample(), 0); 305 EXPECT_EQ(data->queue_duration_sample(), 0);
300 EXPECT_EQ(data->count(), 0); 306 EXPECT_EQ(data->count(), 0);
307 EXPECT_EQ(nullptr, data->last_phase_snapshot());
301 308
302 int32 run_ms = 42; 309 int32 run_ms = 42;
303 int32 queue_ms = 8; 310 int32 queue_ms = 8;
304 311
305 const int kUnrandomInt = 0; // Fake random int that ensure we sample data. 312 const int kUnrandomInt = 0; // Fake random int that ensure we sample data.
306 data->RecordDeath(queue_ms, run_ms, kUnrandomInt); 313 data->RecordDeath(queue_ms, run_ms, kUnrandomInt);
307 EXPECT_EQ(data->run_duration_sum(), run_ms); 314 EXPECT_EQ(data->run_duration_sum(), run_ms);
315 EXPECT_EQ(data->run_duration_max(), run_ms);
308 EXPECT_EQ(data->run_duration_sample(), run_ms); 316 EXPECT_EQ(data->run_duration_sample(), run_ms);
309 EXPECT_EQ(data->queue_duration_sum(), queue_ms); 317 EXPECT_EQ(data->queue_duration_sum(), queue_ms);
318 EXPECT_EQ(data->queue_duration_max(), queue_ms);
310 EXPECT_EQ(data->queue_duration_sample(), queue_ms); 319 EXPECT_EQ(data->queue_duration_sample(), queue_ms);
311 EXPECT_EQ(data->count(), 1); 320 EXPECT_EQ(data->count(), 1);
321 EXPECT_EQ(nullptr, data->last_phase_snapshot());
312 322
313 data->RecordDeath(queue_ms, run_ms, kUnrandomInt); 323 data->RecordDeath(queue_ms, run_ms, kUnrandomInt);
314 EXPECT_EQ(data->run_duration_sum(), run_ms + run_ms); 324 EXPECT_EQ(data->run_duration_sum(), run_ms + run_ms);
325 EXPECT_EQ(data->run_duration_max(), run_ms);
315 EXPECT_EQ(data->run_duration_sample(), run_ms); 326 EXPECT_EQ(data->run_duration_sample(), run_ms);
316 EXPECT_EQ(data->queue_duration_sum(), queue_ms + queue_ms); 327 EXPECT_EQ(data->queue_duration_sum(), queue_ms + queue_ms);
328 EXPECT_EQ(data->queue_duration_max(), queue_ms);
317 EXPECT_EQ(data->queue_duration_sample(), queue_ms); 329 EXPECT_EQ(data->queue_duration_sample(), queue_ms);
318 EXPECT_EQ(data->count(), 2); 330 EXPECT_EQ(data->count(), 2);
331 EXPECT_EQ(nullptr, data->last_phase_snapshot());
319 332
320 DeathDataSnapshot snapshot(*data); 333 data->OnProfilingPhaseCompleted(123);
321 EXPECT_EQ(2, snapshot.count); 334 EXPECT_EQ(data->run_duration_sum(), run_ms + run_ms);
322 EXPECT_EQ(2 * run_ms, snapshot.run_duration_sum); 335 EXPECT_EQ(data->run_duration_max(), 0);
323 EXPECT_EQ(run_ms, snapshot.run_duration_max); 336 EXPECT_EQ(data->run_duration_sample(), run_ms);
324 EXPECT_EQ(run_ms, snapshot.run_duration_sample); 337 EXPECT_EQ(data->queue_duration_sum(), queue_ms + queue_ms);
325 EXPECT_EQ(2 * queue_ms, snapshot.queue_duration_sum); 338 EXPECT_EQ(data->queue_duration_max(), 0);
326 EXPECT_EQ(queue_ms, snapshot.queue_duration_max); 339 EXPECT_EQ(data->queue_duration_sample(), queue_ms);
327 EXPECT_EQ(queue_ms, snapshot.queue_duration_sample); 340 EXPECT_EQ(data->count(), 2);
341 ASSERT_NE(nullptr, data->last_phase_snapshot());
342 EXPECT_EQ(123, data->last_phase_snapshot()->profiling_phase);
343 EXPECT_EQ(2, data->last_phase_snapshot()->death_data.count);
344 EXPECT_EQ(2 * run_ms,
345 data->last_phase_snapshot()->death_data.run_duration_sum);
346 EXPECT_EQ(run_ms, data->last_phase_snapshot()->death_data.run_duration_max);
347 EXPECT_EQ(run_ms,
348 data->last_phase_snapshot()->death_data.run_duration_sample);
349 EXPECT_EQ(2 * queue_ms,
350 data->last_phase_snapshot()->death_data.queue_duration_sum);
351 EXPECT_EQ(queue_ms,
352 data->last_phase_snapshot()->death_data.queue_duration_max);
353 EXPECT_EQ(queue_ms,
354 data->last_phase_snapshot()->death_data.queue_duration_sample);
355 EXPECT_EQ(nullptr, data->last_phase_snapshot()->prev);
356
357 int32 run_ms1 = 21;
358 int32 queue_ms1 = 4;
359
360 data->RecordDeath(queue_ms1, run_ms1, kUnrandomInt);
361 EXPECT_EQ(data->run_duration_sum(), run_ms + run_ms + run_ms1);
362 EXPECT_EQ(data->run_duration_max(), run_ms1);
363 EXPECT_EQ(data->run_duration_sample(), run_ms1);
364 EXPECT_EQ(data->queue_duration_sum(), queue_ms + queue_ms + queue_ms1);
365 EXPECT_EQ(data->queue_duration_max(), queue_ms1);
366 EXPECT_EQ(data->queue_duration_sample(), queue_ms1);
367 EXPECT_EQ(data->count(), 3);
368 ASSERT_NE(nullptr, data->last_phase_snapshot());
369 EXPECT_EQ(123, data->last_phase_snapshot()->profiling_phase);
370 EXPECT_EQ(2, data->last_phase_snapshot()->death_data.count);
371 EXPECT_EQ(2 * run_ms,
372 data->last_phase_snapshot()->death_data.run_duration_sum);
373 EXPECT_EQ(run_ms, data->last_phase_snapshot()->death_data.run_duration_max);
374 EXPECT_EQ(run_ms,
375 data->last_phase_snapshot()->death_data.run_duration_sample);
376 EXPECT_EQ(2 * queue_ms,
377 data->last_phase_snapshot()->death_data.queue_duration_sum);
378 EXPECT_EQ(queue_ms,
379 data->last_phase_snapshot()->death_data.queue_duration_max);
380 EXPECT_EQ(queue_ms,
381 data->last_phase_snapshot()->death_data.queue_duration_sample);
382 EXPECT_EQ(nullptr, data->last_phase_snapshot()->prev);
383 }
384
385 TEST_F(TrackedObjectsTest, CalculateDelta) {
386 if (!ThreadData::InitializeAndSetTrackingStatus(
387 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
388 // Don't run the test if task tracking is not compiled in.
389 return;
390 }
391
392 DeathDataSnapshot snapshot;
393 snapshot.count = 10;
394 snapshot.run_duration_sum = 100;
395 snapshot.run_duration_max = 50;
396 snapshot.run_duration_sample = 25;
397 snapshot.queue_duration_sum = 200;
398 snapshot.queue_duration_max = 101;
399 snapshot.queue_duration_sample = 26;
400
401 DeathDataSnapshot older_snapshot;
402 older_snapshot.count = 2;
403 older_snapshot.run_duration_sum = 95;
404 older_snapshot.run_duration_max = 48;
405 older_snapshot.run_duration_sample = 22;
406 older_snapshot.queue_duration_sum = 190;
407 older_snapshot.queue_duration_max = 99;
408 older_snapshot.queue_duration_sample = 21;
409
410 snapshot.CalculateDelta(older_snapshot);
411 EXPECT_EQ(8, snapshot.count);
412 EXPECT_EQ(5, snapshot.run_duration_sum);
413 EXPECT_EQ(50, snapshot.run_duration_max);
414 EXPECT_EQ(25, snapshot.run_duration_sample);
415 EXPECT_EQ(10, snapshot.queue_duration_sum);
416 EXPECT_EQ(101, snapshot.queue_duration_max);
417 EXPECT_EQ(26, snapshot.queue_duration_sample);
328 } 418 }
329 419
330 TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToSnapshotWorkerThread) { 420 TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToSnapshotWorkerThread) {
331 // Start in the deactivated state. 421 // Start in the deactivated state.
332 if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)) { 422 if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)) {
423 // Don't run the test if task tracking is not compiled in.
333 return; 424 return;
334 } 425 }
335 426
336 const char kFunction[] = "DeactivatedBirthOnlyToSnapshotWorkerThread"; 427 const char kFunction[] = "DeactivatedBirthOnlyToSnapshotWorkerThread";
337 Location location(kFunction, kFile, kLineNumber, NULL); 428 Location location(kFunction, kFile, kLineNumber, NULL);
338 TallyABirth(location, std::string()); 429 TallyABirth(location, std::string());
339 430
340 ProcessDataSnapshot process_data; 431 ProcessDataSnapshot process_data;
341 ThreadData::Snapshot(&process_data); 432 ThreadData::Snapshot(0, &process_data);
342 433
343 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size()); 434 ASSERT_EQ(0u, process_data.phased_process_data_snapshots.size());
344 auto it = process_data.phased_process_data_snapshots.find(0);
345 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end());
346 const ProcessDataPhaseSnapshot& process_data_phase = it->second;
347 435
348 EXPECT_EQ(0u, process_data_phase.tasks.size());
349 EXPECT_EQ(0u, process_data_phase.descendants.size());
350 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); 436 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
351 } 437 }
352 438
353 TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToSnapshotMainThread) { 439 TEST_F(TrackedObjectsTest, DeactivatedBirthOnlyToSnapshotMainThread) {
354 // Start in the deactivated state. 440 // Start in the deactivated state.
355 if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)) { 441 if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)) {
442 // Don't run the test if task tracking is not compiled in.
356 return; 443 return;
357 } 444 }
358 445
359 const char kFunction[] = "DeactivatedBirthOnlyToSnapshotMainThread"; 446 const char kFunction[] = "DeactivatedBirthOnlyToSnapshotMainThread";
360 Location location(kFunction, kFile, kLineNumber, NULL); 447 Location location(kFunction, kFile, kLineNumber, NULL);
361 TallyABirth(location, kMainThreadName); 448 TallyABirth(location, kMainThreadName);
362 449
363 ProcessDataSnapshot process_data; 450 ProcessDataSnapshot process_data;
364 ThreadData::Snapshot(&process_data); 451 ThreadData::Snapshot(0, &process_data);
365 452
366 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size()); 453 ASSERT_EQ(0u, process_data.phased_process_data_snapshots.size());
367 auto it = process_data.phased_process_data_snapshots.find(0);
368 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end());
369 const ProcessDataPhaseSnapshot& process_data_phase = it->second;
370 454
371 EXPECT_EQ(0u, process_data_phase.tasks.size());
372 EXPECT_EQ(0u, process_data_phase.descendants.size());
373 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); 455 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
374 } 456 }
375 457
376 TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotWorkerThread) { 458 TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotWorkerThread) {
377 if (!ThreadData::InitializeAndSetTrackingStatus( 459 if (!ThreadData::InitializeAndSetTrackingStatus(
378 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 460 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
461 // Don't run the test if task tracking is not compiled in.
379 return; 462 return;
380 } 463 }
381 464
382 const char kFunction[] = "BirthOnlyToSnapshotWorkerThread"; 465 const char kFunction[] = "BirthOnlyToSnapshotWorkerThread";
383 Location location(kFunction, kFile, kLineNumber, NULL); 466 Location location(kFunction, kFile, kLineNumber, NULL);
384 TallyABirth(location, std::string()); 467 TallyABirth(location, std::string());
385 468
386 ProcessDataSnapshot process_data; 469 ProcessDataSnapshot process_data;
387 ThreadData::Snapshot(&process_data); 470 ThreadData::Snapshot(0, &process_data);
388 ExpectSimpleProcessData(process_data, kFunction, kWorkerThreadName, 471 ExpectSimpleProcessData(process_data, kFunction, kWorkerThreadName,
389 kStillAlive, 1, 0, 0); 472 kStillAlive, 1, 0, 0);
390 } 473 }
391 474
392 TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotMainThread) { 475 TEST_F(TrackedObjectsTest, BirthOnlyToSnapshotMainThread) {
393 if (!ThreadData::InitializeAndSetTrackingStatus( 476 if (!ThreadData::InitializeAndSetTrackingStatus(
394 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 477 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
478 // Don't run the test if task tracking is not compiled in.
395 return; 479 return;
396 } 480 }
397 481
398 const char kFunction[] = "BirthOnlyToSnapshotMainThread"; 482 const char kFunction[] = "BirthOnlyToSnapshotMainThread";
399 Location location(kFunction, kFile, kLineNumber, NULL); 483 Location location(kFunction, kFile, kLineNumber, NULL);
400 TallyABirth(location, kMainThreadName); 484 TallyABirth(location, kMainThreadName);
401 485
402 ProcessDataSnapshot process_data; 486 ProcessDataSnapshot process_data;
403 ThreadData::Snapshot(&process_data); 487 ThreadData::Snapshot(0, &process_data);
404 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, kStillAlive, 488 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, kStillAlive,
405 1, 0, 0); 489 1, 0, 0);
406 } 490 }
407 491
408 TEST_F(TrackedObjectsTest, LifeCycleToSnapshotMainThread) { 492 TEST_F(TrackedObjectsTest, LifeCycleToSnapshotMainThread) {
409 if (!ThreadData::InitializeAndSetTrackingStatus( 493 if (!ThreadData::InitializeAndSetTrackingStatus(
410 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 494 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
495 // Don't run the test if task tracking is not compiled in.
411 return; 496 return;
412 } 497 }
413 498
414 const char kFunction[] = "LifeCycleToSnapshotMainThread"; 499 const char kFunction[] = "LifeCycleToSnapshotMainThread";
415 Location location(kFunction, kFile, kLineNumber, NULL); 500 Location location(kFunction, kFile, kLineNumber, NULL);
416 TallyABirth(location, kMainThreadName); 501 TallyABirth(location, kMainThreadName);
417 502
418 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 503 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
419 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 504 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
420 // TrackingInfo will call TallyABirth() during construction. 505 // TrackingInfo will call TallyABirth() during construction.
421 base::TrackingInfo pending_task(location, kDelayedStartTime); 506 base::TrackingInfo pending_task(location, kDelayedStartTime);
422 pending_task.time_posted = kTimePosted; // Overwrite implied Now(). 507 pending_task.time_posted = kTimePosted; // Overwrite implied Now().
423 508
424 const unsigned int kStartOfRun = 5; 509 const unsigned int kStartOfRun = 5;
425 const unsigned int kEndOfRun = 7; 510 const unsigned int kEndOfRun = 7;
426 SetTestTime(kStartOfRun); 511 SetTestTime(kStartOfRun);
427 TaskStopwatch stopwatch; 512 TaskStopwatch stopwatch;
428 stopwatch.Start(); 513 stopwatch.Start();
429 SetTestTime(kEndOfRun); 514 SetTestTime(kEndOfRun);
430 stopwatch.Stop(); 515 stopwatch.Stop();
431 516
432 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch); 517 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
433 518
434 ProcessDataSnapshot process_data; 519 ProcessDataSnapshot process_data;
435 ThreadData::Snapshot(&process_data); 520 ThreadData::Snapshot(0, &process_data);
436 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, 521 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName,
437 kMainThreadName, 1, 2, 4); 522 kMainThreadName, 1, 2, 4);
438 } 523 }
439 524
525 TEST_F(TrackedObjectsTest, TwoPhases) {
526 if (!ThreadData::InitializeAndSetTrackingStatus(
527 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
528 // Don't run the test if task tracking is not compiled in.
529 return;
530 }
531
532 const char kFunction[] = "TwoPhases";
533 Location location(kFunction, kFile, kLineNumber, NULL);
534 TallyABirth(location, kMainThreadName);
535
536 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
537 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
538 // TrackingInfo will call TallyABirth() during construction.
539 base::TrackingInfo pending_task(location, kDelayedStartTime);
540 pending_task.time_posted = kTimePosted; // Overwrite implied Now().
541
542 const unsigned int kStartOfRun = 5;
543 const unsigned int kEndOfRun = 7;
544 SetTestTime(kStartOfRun);
545 TaskStopwatch stopwatch;
546 stopwatch.Start();
547 SetTestTime(kEndOfRun);
548 stopwatch.Stop();
549
550 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
551
552 ThreadData::OnProfilingPhaseCompleted(0);
553
554 TallyABirth(location, kMainThreadName);
555
556 const TrackedTime kTimePosted1 = TrackedTime::FromMilliseconds(9);
557 const base::TimeTicks kDelayedStartTime1 = base::TimeTicks();
558 // TrackingInfo will call TallyABirth() during construction.
559 base::TrackingInfo pending_task1(location, kDelayedStartTime1);
560 pending_task1.time_posted = kTimePosted1; // Overwrite implied Now().
561
562 const unsigned int kStartOfRun1 = 11;
563 const unsigned int kEndOfRun1 = 21;
564 SetTestTime(kStartOfRun1);
565 TaskStopwatch stopwatch1;
566 stopwatch1.Start();
567 SetTestTime(kEndOfRun1);
568 stopwatch1.Stop();
569
570 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task1, stopwatch1);
571
572 ProcessDataSnapshot process_data;
573 ThreadData::Snapshot(1, &process_data);
574
575 ASSERT_EQ(2u, process_data.phased_process_data_snapshots.size());
576
577 auto it0 = process_data.phased_process_data_snapshots.find(0);
578 ASSERT_TRUE(it0 != process_data.phased_process_data_snapshots.end());
579 const ProcessDataPhaseSnapshot& process_data_phase0 = it0->second;
580
581 ASSERT_EQ(1u, process_data_phase0.tasks.size());
582
583 EXPECT_EQ(kFile, process_data_phase0.tasks[0].birth.location.file_name);
584 EXPECT_EQ(kFunction,
585 process_data_phase0.tasks[0].birth.location.function_name);
586 EXPECT_EQ(kLineNumber,
587 process_data_phase0.tasks[0].birth.location.line_number);
588
589 EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].birth.thread_name);
590
591 EXPECT_EQ(1, process_data_phase0.tasks[0].death_data.count);
592 EXPECT_EQ(2, process_data_phase0.tasks[0].death_data.run_duration_sum);
593 EXPECT_EQ(2, process_data_phase0.tasks[0].death_data.run_duration_max);
594 EXPECT_EQ(2, process_data_phase0.tasks[0].death_data.run_duration_sample);
595 EXPECT_EQ(4, process_data_phase0.tasks[0].death_data.queue_duration_sum);
596 EXPECT_EQ(4, process_data_phase0.tasks[0].death_data.queue_duration_max);
597 EXPECT_EQ(4, process_data_phase0.tasks[0].death_data.queue_duration_sample);
598
599 EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].death_thread_name);
600
601 EXPECT_EQ(0u, process_data_phase0.descendants.size());
602
603 auto it1 = process_data.phased_process_data_snapshots.find(1);
604 ASSERT_TRUE(it1 != process_data.phased_process_data_snapshots.end());
605 const ProcessDataPhaseSnapshot& process_data_phase1 = it1->second;
606
607 ASSERT_EQ(1u, process_data_phase1.tasks.size());
608
609 EXPECT_EQ(kFile, process_data_phase1.tasks[0].birth.location.file_name);
610 EXPECT_EQ(kFunction,
611 process_data_phase1.tasks[0].birth.location.function_name);
612 EXPECT_EQ(kLineNumber,
613 process_data_phase1.tasks[0].birth.location.line_number);
614
615 EXPECT_EQ(kMainThreadName, process_data_phase1.tasks[0].birth.thread_name);
616
617 EXPECT_EQ(1, process_data_phase1.tasks[0].death_data.count);
618 EXPECT_EQ(10, process_data_phase1.tasks[0].death_data.run_duration_sum);
619 EXPECT_EQ(10, process_data_phase1.tasks[0].death_data.run_duration_max);
620 EXPECT_EQ(10, process_data_phase1.tasks[0].death_data.run_duration_sample);
621 EXPECT_EQ(2, process_data_phase1.tasks[0].death_data.queue_duration_sum);
622 EXPECT_EQ(2, process_data_phase1.tasks[0].death_data.queue_duration_max);
623 EXPECT_EQ(2, process_data_phase1.tasks[0].death_data.queue_duration_sample);
624
625 EXPECT_EQ(kMainThreadName, process_data_phase1.tasks[0].death_thread_name);
626
627 EXPECT_EQ(0u, process_data_phase1.descendants.size());
628
629 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
630 }
631
632 TEST_F(TrackedObjectsTest, ThreePhases) {
633 if (!ThreadData::InitializeAndSetTrackingStatus(
634 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
635 // Don't run the test if task tracking is not compiled in.
636 return;
637 }
638
639 const char kFunction[] = "ThreePhases";
640 Location location(kFunction, kFile, kLineNumber, NULL);
641
642 // Phase 0
643 {
644 TallyABirth(location, kMainThreadName);
645
646 // TrackingInfo will call TallyABirth() during construction.
647 SetTestTime(10);
648 base::TrackingInfo pending_task(location, base::TimeTicks());
649
650 SetTestTime(17);
651 TaskStopwatch stopwatch;
652 stopwatch.Start();
653 SetTestTime(23);
654 stopwatch.Stop();
655
656 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
657 }
658
659 ThreadData::OnProfilingPhaseCompleted(0);
660
661 // Phase 1
662 {
663 TallyABirth(location, kMainThreadName);
664
665 SetTestTime(30);
666 base::TrackingInfo pending_task(location, base::TimeTicks());
667
668 SetTestTime(35);
669 TaskStopwatch stopwatch;
670 stopwatch.Start();
671 SetTestTime(39);
672 stopwatch.Stop();
673
674 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
675 }
676
677 ThreadData::OnProfilingPhaseCompleted(1);
678
679 // Phase 2
680 {
681 TallyABirth(location, kMainThreadName);
682
683 // TrackingInfo will call TallyABirth() during construction.
684 SetTestTime(40);
685 base::TrackingInfo pending_task(location, base::TimeTicks());
686
687 SetTestTime(43);
688 TaskStopwatch stopwatch;
689 stopwatch.Start();
690 SetTestTime(45);
691 stopwatch.Stop();
692
693 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
694 }
695
696 // Snapshot and check results.
697 ProcessDataSnapshot process_data;
698 ThreadData::Snapshot(2, &process_data);
699
700 ASSERT_EQ(3u, process_data.phased_process_data_snapshots.size());
701
702 auto it0 = process_data.phased_process_data_snapshots.find(0);
703 ASSERT_TRUE(it0 != process_data.phased_process_data_snapshots.end());
704 const ProcessDataPhaseSnapshot& process_data_phase0 = it0->second;
705
706 ASSERT_EQ(1u, process_data_phase0.tasks.size());
707
708 EXPECT_EQ(kFile, process_data_phase0.tasks[0].birth.location.file_name);
709 EXPECT_EQ(kFunction,
710 process_data_phase0.tasks[0].birth.location.function_name);
711 EXPECT_EQ(kLineNumber,
712 process_data_phase0.tasks[0].birth.location.line_number);
713
714 EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].birth.thread_name);
715
716 EXPECT_EQ(1, process_data_phase0.tasks[0].death_data.count);
717 EXPECT_EQ(6, process_data_phase0.tasks[0].death_data.run_duration_sum);
718 EXPECT_EQ(6, process_data_phase0.tasks[0].death_data.run_duration_max);
719 EXPECT_EQ(6, process_data_phase0.tasks[0].death_data.run_duration_sample);
720 EXPECT_EQ(7, process_data_phase0.tasks[0].death_data.queue_duration_sum);
721 EXPECT_EQ(7, process_data_phase0.tasks[0].death_data.queue_duration_max);
722 EXPECT_EQ(7, process_data_phase0.tasks[0].death_data.queue_duration_sample);
723
724 EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].death_thread_name);
725
726 EXPECT_EQ(0u, process_data_phase0.descendants.size());
727
728 auto it1 = process_data.phased_process_data_snapshots.find(1);
729 ASSERT_TRUE(it1 != process_data.phased_process_data_snapshots.end());
730 const ProcessDataPhaseSnapshot& process_data_phase1 = it1->second;
731
732 ASSERT_EQ(1u, process_data_phase1.tasks.size());
733
734 EXPECT_EQ(kFile, process_data_phase1.tasks[0].birth.location.file_name);
735 EXPECT_EQ(kFunction,
736 process_data_phase1.tasks[0].birth.location.function_name);
737 EXPECT_EQ(kLineNumber,
738 process_data_phase1.tasks[0].birth.location.line_number);
739
740 EXPECT_EQ(kMainThreadName, process_data_phase1.tasks[0].birth.thread_name);
741
742 EXPECT_EQ(1, process_data_phase1.tasks[0].death_data.count);
743 EXPECT_EQ(4, process_data_phase1.tasks[0].death_data.run_duration_sum);
744 EXPECT_EQ(4, process_data_phase1.tasks[0].death_data.run_duration_max);
745 EXPECT_EQ(4, process_data_phase1.tasks[0].death_data.run_duration_sample);
746 EXPECT_EQ(5, process_data_phase1.tasks[0].death_data.queue_duration_sum);
747 EXPECT_EQ(5, process_data_phase1.tasks[0].death_data.queue_duration_max);
748 EXPECT_EQ(5, process_data_phase1.tasks[0].death_data.queue_duration_sample);
749
750 EXPECT_EQ(kMainThreadName, process_data_phase1.tasks[0].death_thread_name);
751
752 EXPECT_EQ(0u, process_data_phase1.descendants.size());
753
754 auto it2 = process_data.phased_process_data_snapshots.find(2);
755 ASSERT_TRUE(it2 != process_data.phased_process_data_snapshots.end());
756 const ProcessDataPhaseSnapshot& process_data_phase2 = it2->second;
757
758 ASSERT_EQ(1u, process_data_phase2.tasks.size());
759
760 EXPECT_EQ(kFile, process_data_phase2.tasks[0].birth.location.file_name);
761 EXPECT_EQ(kFunction,
762 process_data_phase2.tasks[0].birth.location.function_name);
763 EXPECT_EQ(kLineNumber,
764 process_data_phase2.tasks[0].birth.location.line_number);
765
766 EXPECT_EQ(kMainThreadName, process_data_phase2.tasks[0].birth.thread_name);
767
768 EXPECT_EQ(1, process_data_phase2.tasks[0].death_data.count);
769 EXPECT_EQ(2, process_data_phase2.tasks[0].death_data.run_duration_sum);
770 EXPECT_EQ(2, process_data_phase2.tasks[0].death_data.run_duration_max);
771 EXPECT_EQ(2, process_data_phase2.tasks[0].death_data.run_duration_sample);
772 EXPECT_EQ(3, process_data_phase2.tasks[0].death_data.queue_duration_sum);
773 EXPECT_EQ(3, process_data_phase2.tasks[0].death_data.queue_duration_max);
774 EXPECT_EQ(3, process_data_phase2.tasks[0].death_data.queue_duration_sample);
775
776 EXPECT_EQ(kMainThreadName, process_data_phase2.tasks[0].death_thread_name);
777
778 EXPECT_EQ(0u, process_data_phase2.descendants.size());
779
780 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
781 }
782
783 TEST_F(TrackedObjectsTest, TwoPhasesSecondEmpty) {
784 if (!ThreadData::InitializeAndSetTrackingStatus(
785 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
786 // Don't run the test if task tracking is not compiled in.
787 return;
788 }
789
790 const char kFunction[] = "TwoPhasesSecondEmpty";
791 Location location(kFunction, kFile, kLineNumber, NULL);
792 ThreadData::InitializeThreadContext(kMainThreadName);
793
794 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
795 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
796 // TrackingInfo will call TallyABirth() during construction.
797 base::TrackingInfo pending_task(location, kDelayedStartTime);
798 pending_task.time_posted = kTimePosted; // Overwrite implied Now().
799
800 const unsigned int kStartOfRun = 5;
801 const unsigned int kEndOfRun = 7;
802 SetTestTime(kStartOfRun);
803 TaskStopwatch stopwatch;
804 stopwatch.Start();
805 SetTestTime(kEndOfRun);
806 stopwatch.Stop();
807
808 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
809
810 ThreadData::OnProfilingPhaseCompleted(0);
811
812 ProcessDataSnapshot process_data;
813 ThreadData::Snapshot(1, &process_data);
814
815 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size());
816
817 auto it0 = process_data.phased_process_data_snapshots.find(0);
818 ASSERT_TRUE(it0 != process_data.phased_process_data_snapshots.end());
819 const ProcessDataPhaseSnapshot& process_data_phase0 = it0->second;
820
821 ASSERT_EQ(1u, process_data_phase0.tasks.size());
822
823 EXPECT_EQ(kFile, process_data_phase0.tasks[0].birth.location.file_name);
824 EXPECT_EQ(kFunction,
825 process_data_phase0.tasks[0].birth.location.function_name);
826 EXPECT_EQ(kLineNumber,
827 process_data_phase0.tasks[0].birth.location.line_number);
828
829 EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].birth.thread_name);
830
831 EXPECT_EQ(1, process_data_phase0.tasks[0].death_data.count);
832 EXPECT_EQ(2, process_data_phase0.tasks[0].death_data.run_duration_sum);
833 EXPECT_EQ(2, process_data_phase0.tasks[0].death_data.run_duration_max);
834 EXPECT_EQ(2, process_data_phase0.tasks[0].death_data.run_duration_sample);
835 EXPECT_EQ(4, process_data_phase0.tasks[0].death_data.queue_duration_sum);
836 EXPECT_EQ(4, process_data_phase0.tasks[0].death_data.queue_duration_max);
837 EXPECT_EQ(4, process_data_phase0.tasks[0].death_data.queue_duration_sample);
838
839 EXPECT_EQ(kMainThreadName, process_data_phase0.tasks[0].death_thread_name);
840
841 EXPECT_EQ(0u, process_data_phase0.descendants.size());
842
843 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
844 }
845
440 // We will deactivate tracking after the birth, and before the death, and 846 // We will deactivate tracking after the birth, and before the death, and
441 // demonstrate that the lifecycle is completely tallied. This ensures that 847 // demonstrate that the lifecycle is completely tallied. This ensures that
442 // our tallied births are matched by tallied deaths (except for when the 848 // our tallied births are matched by tallied deaths (except for when the
443 // task is still running, or is queued). 849 // task is still running, or is queued).
444 TEST_F(TrackedObjectsTest, LifeCycleMidDeactivatedToSnapshotMainThread) { 850 TEST_F(TrackedObjectsTest, LifeCycleMidDeactivatedToSnapshotMainThread) {
445 if (!ThreadData::InitializeAndSetTrackingStatus( 851 if (!ThreadData::InitializeAndSetTrackingStatus(
446 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 852 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
853 // Don't run the test if task tracking is not compiled in.
447 return; 854 return;
448 } 855 }
449 856
450 const char kFunction[] = "LifeCycleMidDeactivatedToSnapshotMainThread"; 857 const char kFunction[] = "LifeCycleMidDeactivatedToSnapshotMainThread";
451 Location location(kFunction, kFile, kLineNumber, NULL); 858 Location location(kFunction, kFile, kLineNumber, NULL);
452 TallyABirth(location, kMainThreadName); 859 TallyABirth(location, kMainThreadName);
453 860
454 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 861 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
455 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 862 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
456 // TrackingInfo will call TallyABirth() during construction. 863 // TrackingInfo will call TallyABirth() during construction.
457 base::TrackingInfo pending_task(location, kDelayedStartTime); 864 base::TrackingInfo pending_task(location, kDelayedStartTime);
458 pending_task.time_posted = kTimePosted; // Overwrite implied Now(). 865 pending_task.time_posted = kTimePosted; // Overwrite implied Now().
459 866
460 // Turn off tracking now that we have births. 867 // Turn off tracking now that we have births.
461 EXPECT_TRUE( 868 EXPECT_TRUE(
462 ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)); 869 ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED));
463 870
464 const unsigned int kStartOfRun = 5; 871 const unsigned int kStartOfRun = 5;
465 const unsigned int kEndOfRun = 7; 872 const unsigned int kEndOfRun = 7;
466 SetTestTime(kStartOfRun); 873 SetTestTime(kStartOfRun);
467 TaskStopwatch stopwatch; 874 TaskStopwatch stopwatch;
468 stopwatch.Start(); 875 stopwatch.Start();
469 SetTestTime(kEndOfRun); 876 SetTestTime(kEndOfRun);
470 stopwatch.Stop(); 877 stopwatch.Stop();
471 878
472 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch); 879 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
473 880
474 ProcessDataSnapshot process_data; 881 ProcessDataSnapshot process_data;
475 ThreadData::Snapshot(&process_data); 882 ThreadData::Snapshot(0, &process_data);
476 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, 883 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName,
477 kMainThreadName, 1, 2, 4); 884 kMainThreadName, 1, 2, 4);
478 } 885 }
479 886
480 // We will deactivate tracking before starting a life cycle, and neither 887 // We will deactivate tracking before starting a life cycle, and neither
481 // the birth nor the death will be recorded. 888 // the birth nor the death will be recorded.
482 TEST_F(TrackedObjectsTest, LifeCyclePreDeactivatedToSnapshotMainThread) { 889 TEST_F(TrackedObjectsTest, LifeCyclePreDeactivatedToSnapshotMainThread) {
483 // Start in the deactivated state. 890 // Start in the deactivated state.
484 if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)) { 891 if (!ThreadData::InitializeAndSetTrackingStatus(ThreadData::DEACTIVATED)) {
892 // Don't run the test if task tracking is not compiled in.
485 return; 893 return;
486 } 894 }
487 895
488 const char kFunction[] = "LifeCyclePreDeactivatedToSnapshotMainThread"; 896 const char kFunction[] = "LifeCyclePreDeactivatedToSnapshotMainThread";
489 Location location(kFunction, kFile, kLineNumber, NULL); 897 Location location(kFunction, kFile, kLineNumber, NULL);
490 TallyABirth(location, kMainThreadName); 898 TallyABirth(location, kMainThreadName);
491 899
492 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 900 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
493 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 901 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
494 // TrackingInfo will call TallyABirth() during construction. 902 // TrackingInfo will call TallyABirth() during construction.
495 base::TrackingInfo pending_task(location, kDelayedStartTime); 903 base::TrackingInfo pending_task(location, kDelayedStartTime);
496 pending_task.time_posted = kTimePosted; // Overwrite implied Now(). 904 pending_task.time_posted = kTimePosted; // Overwrite implied Now().
497 905
498 const unsigned int kStartOfRun = 5; 906 const unsigned int kStartOfRun = 5;
499 const unsigned int kEndOfRun = 7; 907 const unsigned int kEndOfRun = 7;
500 SetTestTime(kStartOfRun); 908 SetTestTime(kStartOfRun);
501 TaskStopwatch stopwatch; 909 TaskStopwatch stopwatch;
502 stopwatch.Start(); 910 stopwatch.Start();
503 SetTestTime(kEndOfRun); 911 SetTestTime(kEndOfRun);
504 stopwatch.Stop(); 912 stopwatch.Stop();
505 913
506 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch); 914 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
507 915
508 ProcessDataSnapshot process_data; 916 ProcessDataSnapshot process_data;
509 ThreadData::Snapshot(&process_data); 917 ThreadData::Snapshot(0, &process_data);
510 918
511 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size()); 919 ASSERT_EQ(0u, process_data.phased_process_data_snapshots.size());
512 auto it = process_data.phased_process_data_snapshots.find(0);
513 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end());
514 const ProcessDataPhaseSnapshot& process_data_phase = it->second;
515 920
516 EXPECT_EQ(0u, process_data_phase.tasks.size());
517 EXPECT_EQ(0u, process_data_phase.descendants.size());
518 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); 921 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
519 } 922 }
520 923
521 TEST_F(TrackedObjectsTest, TwoLives) { 924 TEST_F(TrackedObjectsTest, TwoLives) {
522 if (!ThreadData::InitializeAndSetTrackingStatus( 925 if (!ThreadData::InitializeAndSetTrackingStatus(
523 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 926 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
927 // Don't run the test if task tracking is not compiled in.
524 return; 928 return;
525 } 929 }
526 930
527 const char kFunction[] = "TwoLives"; 931 const char kFunction[] = "TwoLives";
528 Location location(kFunction, kFile, kLineNumber, NULL); 932 Location location(kFunction, kFile, kLineNumber, NULL);
529 TallyABirth(location, kMainThreadName); 933 TallyABirth(location, kMainThreadName);
530 934
531 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 935 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
532 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 936 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
533 // TrackingInfo will call TallyABirth() during construction. 937 // TrackingInfo will call TallyABirth() during construction.
(...skipping 15 matching lines...) Expand all
549 pending_task2.time_posted = kTimePosted; // Overwrite implied Now(). 953 pending_task2.time_posted = kTimePosted; // Overwrite implied Now().
550 SetTestTime(kStartOfRun); 954 SetTestTime(kStartOfRun);
551 TaskStopwatch stopwatch2; 955 TaskStopwatch stopwatch2;
552 stopwatch2.Start(); 956 stopwatch2.Start();
553 SetTestTime(kEndOfRun); 957 SetTestTime(kEndOfRun);
554 stopwatch2.Stop(); 958 stopwatch2.Stop();
555 959
556 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task2, stopwatch2); 960 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task2, stopwatch2);
557 961
558 ProcessDataSnapshot process_data; 962 ProcessDataSnapshot process_data;
559 ThreadData::Snapshot(&process_data); 963 ThreadData::Snapshot(0, &process_data);
560 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, 964 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName,
561 kMainThreadName, 2, 2, 4); 965 kMainThreadName, 2, 2, 4);
562 } 966 }
563 967
564 TEST_F(TrackedObjectsTest, DifferentLives) { 968 TEST_F(TrackedObjectsTest, DifferentLives) {
565 if (!ThreadData::InitializeAndSetTrackingStatus( 969 if (!ThreadData::InitializeAndSetTrackingStatus(
566 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 970 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
971 // Don't run the test if task tracking is not compiled in.
567 return; 972 return;
568 } 973 }
569 974
570 // Use a well named thread. 975 // Use a well named thread.
571 ThreadData::InitializeThreadContext(kMainThreadName); 976 ThreadData::InitializeThreadContext(kMainThreadName);
572 const char kFunction[] = "DifferentLives"; 977 const char kFunction[] = "DifferentLives";
573 Location location(kFunction, kFile, kLineNumber, NULL); 978 Location location(kFunction, kFile, kLineNumber, NULL);
574 979
575 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 980 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
576 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 981 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
(...skipping 12 matching lines...) Expand all
589 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch); 994 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, stopwatch);
590 995
591 const int kSecondFakeLineNumber = 999; 996 const int kSecondFakeLineNumber = 999;
592 Location second_location(kFunction, kFile, kSecondFakeLineNumber, NULL); 997 Location second_location(kFunction, kFile, kSecondFakeLineNumber, NULL);
593 998
594 // TrackingInfo will call TallyABirth() during construction. 999 // TrackingInfo will call TallyABirth() during construction.
595 base::TrackingInfo pending_task2(second_location, kDelayedStartTime); 1000 base::TrackingInfo pending_task2(second_location, kDelayedStartTime);
596 pending_task2.time_posted = kTimePosted; // Overwrite implied Now(). 1001 pending_task2.time_posted = kTimePosted; // Overwrite implied Now().
597 1002
598 ProcessDataSnapshot process_data; 1003 ProcessDataSnapshot process_data;
599 ThreadData::Snapshot(&process_data); 1004 ThreadData::Snapshot(0, &process_data);
600 1005
601 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size()); 1006 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size());
602 auto it = process_data.phased_process_data_snapshots.find(0); 1007 auto it = process_data.phased_process_data_snapshots.find(0);
603 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end()); 1008 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end());
604 const ProcessDataPhaseSnapshot& process_data_phase = it->second; 1009 const ProcessDataPhaseSnapshot& process_data_phase = it->second;
605 1010
606 ASSERT_EQ(2u, process_data_phase.tasks.size()); 1011 ASSERT_EQ(2u, process_data_phase.tasks.size());
607 1012
608 EXPECT_EQ(kFile, process_data_phase.tasks[0].birth.location.file_name); 1013 EXPECT_EQ(kFile, process_data_phase.tasks[0].birth.location.file_name);
609 EXPECT_EQ(kFunction, 1014 EXPECT_EQ(kFunction,
(...skipping 23 matching lines...) Expand all
633 EXPECT_EQ(0, process_data_phase.tasks[1].death_data.queue_duration_max); 1038 EXPECT_EQ(0, process_data_phase.tasks[1].death_data.queue_duration_max);
634 EXPECT_EQ(0, process_data_phase.tasks[1].death_data.queue_duration_sample); 1039 EXPECT_EQ(0, process_data_phase.tasks[1].death_data.queue_duration_sample);
635 EXPECT_EQ(kStillAlive, process_data_phase.tasks[1].death_thread_name); 1040 EXPECT_EQ(kStillAlive, process_data_phase.tasks[1].death_thread_name);
636 EXPECT_EQ(0u, process_data_phase.descendants.size()); 1041 EXPECT_EQ(0u, process_data_phase.descendants.size());
637 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); 1042 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
638 } 1043 }
639 1044
640 TEST_F(TrackedObjectsTest, TaskWithNestedExclusion) { 1045 TEST_F(TrackedObjectsTest, TaskWithNestedExclusion) {
641 if (!ThreadData::InitializeAndSetTrackingStatus( 1046 if (!ThreadData::InitializeAndSetTrackingStatus(
642 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 1047 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
1048 // Don't run the test if task tracking is not compiled in.
643 return; 1049 return;
644 } 1050 }
645 1051
646 const char kFunction[] = "TaskWithNestedExclusion"; 1052 const char kFunction[] = "TaskWithNestedExclusion";
647 Location location(kFunction, kFile, kLineNumber, NULL); 1053 Location location(kFunction, kFile, kLineNumber, NULL);
648 TallyABirth(location, kMainThreadName); 1054 TallyABirth(location, kMainThreadName);
649 1055
650 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 1056 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
651 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 1057 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
652 // TrackingInfo will call TallyABirth() during construction. 1058 // TrackingInfo will call TallyABirth() during construction.
653 base::TrackingInfo pending_task(location, kDelayedStartTime); 1059 base::TrackingInfo pending_task(location, kDelayedStartTime);
654 pending_task.time_posted = kTimePosted; // Overwrite implied Now(). 1060 pending_task.time_posted = kTimePosted; // Overwrite implied Now().
655 1061
656 SetTestTime(5); 1062 SetTestTime(5);
657 TaskStopwatch task_stopwatch; 1063 TaskStopwatch task_stopwatch;
658 task_stopwatch.Start(); 1064 task_stopwatch.Start();
659 { 1065 {
660 SetTestTime(8); 1066 SetTestTime(8);
661 TaskStopwatch exclusion_stopwatch; 1067 TaskStopwatch exclusion_stopwatch;
662 exclusion_stopwatch.Start(); 1068 exclusion_stopwatch.Start();
663 SetTestTime(12); 1069 SetTestTime(12);
664 exclusion_stopwatch.Stop(); 1070 exclusion_stopwatch.Stop();
665 } 1071 }
666 SetTestTime(15); 1072 SetTestTime(15);
667 task_stopwatch.Stop(); 1073 task_stopwatch.Stop();
668 1074
669 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, task_stopwatch); 1075 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, task_stopwatch);
670 1076
671 ProcessDataSnapshot process_data; 1077 ProcessDataSnapshot process_data;
672 ThreadData::Snapshot(&process_data); 1078 ThreadData::Snapshot(0, &process_data);
673 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, 1079 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName,
674 kMainThreadName, 1, 6, 4); 1080 kMainThreadName, 1, 6, 4);
675 } 1081 }
676 1082
677 TEST_F(TrackedObjectsTest, TaskWith2NestedExclusions) { 1083 TEST_F(TrackedObjectsTest, TaskWith2NestedExclusions) {
678 if (!ThreadData::InitializeAndSetTrackingStatus( 1084 if (!ThreadData::InitializeAndSetTrackingStatus(
679 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 1085 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
1086 // Don't run the test if task tracking is not compiled in.
680 return; 1087 return;
681 } 1088 }
682 1089
683 const char kFunction[] = "TaskWith2NestedExclusions"; 1090 const char kFunction[] = "TaskWith2NestedExclusions";
684 Location location(kFunction, kFile, kLineNumber, NULL); 1091 Location location(kFunction, kFile, kLineNumber, NULL);
685 TallyABirth(location, kMainThreadName); 1092 TallyABirth(location, kMainThreadName);
686 1093
687 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1); 1094 const TrackedTime kTimePosted = TrackedTime::FromMilliseconds(1);
688 const base::TimeTicks kDelayedStartTime = base::TimeTicks(); 1095 const base::TimeTicks kDelayedStartTime = base::TimeTicks();
689 // TrackingInfo will call TallyABirth() during construction. 1096 // TrackingInfo will call TallyABirth() during construction.
(...skipping 15 matching lines...) Expand all
705 exclusion_stopwatch2.Start(); 1112 exclusion_stopwatch2.Start();
706 SetTestTime(18); 1113 SetTestTime(18);
707 exclusion_stopwatch2.Stop(); 1114 exclusion_stopwatch2.Stop();
708 } 1115 }
709 SetTestTime(25); 1116 SetTestTime(25);
710 task_stopwatch.Stop(); 1117 task_stopwatch.Stop();
711 1118
712 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, task_stopwatch); 1119 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, task_stopwatch);
713 1120
714 ProcessDataSnapshot process_data; 1121 ProcessDataSnapshot process_data;
715 ThreadData::Snapshot(&process_data); 1122 ThreadData::Snapshot(0, &process_data);
716 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName, 1123 ExpectSimpleProcessData(process_data, kFunction, kMainThreadName,
717 kMainThreadName, 1, 13, 4); 1124 kMainThreadName, 1, 13, 4);
718 } 1125 }
719 1126
720 TEST_F(TrackedObjectsTest, TaskWithNestedExclusionWithNestedTask) { 1127 TEST_F(TrackedObjectsTest, TaskWithNestedExclusionWithNestedTask) {
721 if (!ThreadData::InitializeAndSetTrackingStatus( 1128 if (!ThreadData::InitializeAndSetTrackingStatus(
722 ThreadData::PROFILING_CHILDREN_ACTIVE)) { 1129 ThreadData::PROFILING_CHILDREN_ACTIVE)) {
1130 // Don't run the test if task tracking is not compiled in.
723 return; 1131 return;
724 } 1132 }
725 1133
726 const char kFunction[] = "TaskWithNestedExclusionWithNestedTask"; 1134 const char kFunction[] = "TaskWithNestedExclusionWithNestedTask";
727 Location location(kFunction, kFile, kLineNumber, NULL); 1135 Location location(kFunction, kFile, kLineNumber, NULL);
728 1136
729 const int kSecondFakeLineNumber = 999; 1137 const int kSecondFakeLineNumber = 999;
730 1138
731 TallyABirth(location, kMainThreadName); 1139 TallyABirth(location, kMainThreadName);
732 1140
(...skipping 25 matching lines...) Expand all
758 } 1166 }
759 SetTestTime(12); 1167 SetTestTime(12);
760 exclusion_stopwatch.Stop(); 1168 exclusion_stopwatch.Stop();
761 } 1169 }
762 SetTestTime(15); 1170 SetTestTime(15);
763 task_stopwatch.Stop(); 1171 task_stopwatch.Stop();
764 1172
765 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, task_stopwatch); 1173 ThreadData::TallyRunOnNamedThreadIfTracking(pending_task, task_stopwatch);
766 1174
767 ProcessDataSnapshot process_data; 1175 ProcessDataSnapshot process_data;
768 ThreadData::Snapshot(&process_data); 1176 ThreadData::Snapshot(0, &process_data);
769 1177
770 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size()); 1178 ASSERT_EQ(1u, process_data.phased_process_data_snapshots.size());
771 auto it = process_data.phased_process_data_snapshots.find(0); 1179 auto it = process_data.phased_process_data_snapshots.find(0);
772 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end()); 1180 ASSERT_TRUE(it != process_data.phased_process_data_snapshots.end());
773 const ProcessDataPhaseSnapshot& process_data_phase = it->second; 1181 const ProcessDataPhaseSnapshot& process_data_phase = it->second;
774 1182
775 // The order in which the two task follow is platform-dependent. 1183 // The order in which the two task follow is platform-dependent.
776 int t0 = 1184 int t0 =
777 (process_data_phase.tasks[0].birth.location.line_number == kLineNumber) 1185 (process_data_phase.tasks[0].birth.location.line_number == kLineNumber)
778 ? 0 1186 ? 0
(...skipping 27 matching lines...) Expand all
806 EXPECT_EQ(2, process_data_phase.tasks[t1].death_data.run_duration_sample); 1214 EXPECT_EQ(2, process_data_phase.tasks[t1].death_data.run_duration_sample);
807 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sum); 1215 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sum);
808 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_max); 1216 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_max);
809 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sample); 1217 EXPECT_EQ(1, process_data_phase.tasks[t1].death_data.queue_duration_sample);
810 EXPECT_EQ(kMainThreadName, process_data_phase.tasks[t1].death_thread_name); 1218 EXPECT_EQ(kMainThreadName, process_data_phase.tasks[t1].death_thread_name);
811 EXPECT_EQ(0u, process_data_phase.descendants.size()); 1219 EXPECT_EQ(0u, process_data_phase.descendants.size());
812 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id); 1220 EXPECT_EQ(base::GetCurrentProcId(), process_data.process_id);
813 } 1221 }
814 1222
815 } // namespace tracked_objects 1223 } // namespace tracked_objects
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698