OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/message_loop.h" | 10 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
11 | 12 |
12 using base::TimeDelta; | 13 using base::TimeDelta; |
13 | 14 |
14 namespace tracked_objects { | 15 namespace tracked_objects { |
15 | 16 |
16 // A TLS slot to the TrackRegistry for the current thread. | 17 // A TLS slot to the TrackRegistry for the current thread. |
17 // static | 18 // static |
18 TLSSlot ThreadData::tls_index_(base::LINKER_INITIALIZED); | 19 TLSSlot ThreadData::tls_index_(base::LINKER_INITIALIZED); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 545 |
545 void Aggregation::AddBirthPlace(const Location& location) { | 546 void Aggregation::AddBirthPlace(const Location& location) { |
546 locations_[location]++; | 547 locations_[location]++; |
547 birth_files_[location.file_name()]++; | 548 birth_files_[location.file_name()]++; |
548 } | 549 } |
549 | 550 |
550 void Aggregation::Write(std::string* output) const { | 551 void Aggregation::Write(std::string* output) const { |
551 if (locations_.size() == 1) { | 552 if (locations_.size() == 1) { |
552 locations_.begin()->first.Write(true, true, output); | 553 locations_.begin()->first.Write(true, true, output); |
553 } else { | 554 } else { |
554 StringAppendF(output, "%d Locations. ", locations_.size()); | 555 StringAppendF(output, "%" PRIuS " Locations. ", locations_.size()); |
555 if (birth_files_.size() > 1) | 556 if (birth_files_.size() > 1) |
556 StringAppendF(output, "%d Files. ", birth_files_.size()); | 557 StringAppendF(output, "%" PRIuS " Files. ", birth_files_.size()); |
557 else | 558 else |
558 StringAppendF(output, "All born in %s. ", | 559 StringAppendF(output, "All born in %s. ", |
559 birth_files_.begin()->first.c_str()); | 560 birth_files_.begin()->first.c_str()); |
560 } | 561 } |
561 | 562 |
562 if (birth_threads_.size() > 1) | 563 if (birth_threads_.size() > 1) |
563 StringAppendF(output, "%d BirthingThreads. ", birth_threads_.size()); | 564 StringAppendF(output, "%" PRIuS " BirthingThreads. ", |
| 565 birth_threads_.size()); |
564 else | 566 else |
565 StringAppendF(output, "All born on %s. ", | 567 StringAppendF(output, "All born on %s. ", |
566 birth_threads_.begin()->first->ThreadName().c_str()); | 568 birth_threads_.begin()->first->ThreadName().c_str()); |
567 | 569 |
568 if (death_threads_.size() > 1) { | 570 if (death_threads_.size() > 1) { |
569 StringAppendF(output, "%d DeathThreads. ", death_threads_.size()); | 571 StringAppendF(output, "%" PRIuS " DeathThreads. ", death_threads_.size()); |
570 } else { | 572 } else { |
571 if (death_threads_.begin()->first) | 573 if (death_threads_.begin()->first) |
572 StringAppendF(output, "All deleted on %s. ", | 574 StringAppendF(output, "All deleted on %s. ", |
573 death_threads_.begin()->first->ThreadName().c_str()); | 575 death_threads_.begin()->first->ThreadName().c_str()); |
574 else | 576 else |
575 output->append("All these objects are still alive."); | 577 output->append("All these objects are still alive."); |
576 } | 578 } |
577 | 579 |
578 if (birth_count_ > 1) | 580 if (birth_count_ > 1) |
579 StringAppendF(output, "Births=%d ", birth_count_); | 581 StringAppendF(output, "Births=%d ", birth_count_); |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 900 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
899 sample.birth().birth_thread()->ThreadName().c_str(), | 901 sample.birth().birth_thread()->ThreadName().c_str(), |
900 (combined_selectors_ & DEATH_THREAD) ? "*" : | 902 (combined_selectors_ & DEATH_THREAD) ? "*" : |
901 sample.DeathThreadName().c_str()); | 903 sample.DeathThreadName().c_str()); |
902 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 904 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
903 !(combined_selectors_ & BIRTH_FUNCTION), | 905 !(combined_selectors_ & BIRTH_FUNCTION), |
904 output); | 906 output); |
905 } | 907 } |
906 | 908 |
907 } // namespace tracked_objects | 909 } // namespace tracked_objects |
OLD | NEW |