OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/tracked_objects.h" | 5 #include "base/tracked_objects.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 // that our data structures (which counted the outstanding births) remain | 524 // that our data structures (which counted the outstanding births) remain |
525 // consistent. | 525 // consistent. |
526 if (!birth) | 526 if (!birth) |
527 return; | 527 return; |
528 | 528 |
529 ThreadData* current_thread_data = Get(); | 529 ThreadData* current_thread_data = Get(); |
530 if (!current_thread_data) | 530 if (!current_thread_data) |
531 return; | 531 return; |
532 | 532 |
533 DurationInt queue_duration = 0; | 533 DurationInt queue_duration = 0; |
534 DurationInt run_duration = (end_of_run - start_of_run).InMilliseconds(); | 534 DurationInt run_duration = 0; |
| 535 if (!start_of_run.is_null() && !end_of_run.is_null()) |
| 536 run_duration = (end_of_run - start_of_run).InMilliseconds(); |
535 current_thread_data->TallyADeath(*birth, queue_duration, run_duration); | 537 current_thread_data->TallyADeath(*birth, queue_duration, run_duration); |
536 } | 538 } |
537 | 539 |
538 | 540 |
539 | 541 |
540 // static | 542 // static |
541 ThreadData* ThreadData::first() { | 543 ThreadData* ThreadData::first() { |
542 base::AutoLock lock(*list_lock_.Pointer()); | 544 base::AutoLock lock(*list_lock_.Pointer()); |
543 return all_thread_data_list_head_; | 545 return all_thread_data_list_head_; |
544 } | 546 } |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 1270 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
1269 sample.birth().birth_thread()->thread_name().c_str(), | 1271 sample.birth().birth_thread()->thread_name().c_str(), |
1270 (combined_selectors_ & DEATH_THREAD) ? "*" : | 1272 (combined_selectors_ & DEATH_THREAD) ? "*" : |
1271 sample.DeathThreadName().c_str()); | 1273 sample.DeathThreadName().c_str()); |
1272 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 1274 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
1273 !(combined_selectors_ & BIRTH_FUNCTION), | 1275 !(combined_selectors_ & BIRTH_FUNCTION), |
1274 output); | 1276 output); |
1275 } | 1277 } |
1276 | 1278 |
1277 } // namespace tracked_objects | 1279 } // namespace tracked_objects |
OLD | NEW |