| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/thread_restrictions.h" | 13 #include "base/thread_restrictions.h" |
| 14 | 14 |
| 15 using base::TimeDelta; | 15 using base::TimeDelta; |
| 16 | 16 |
| 17 namespace tracked_objects { | 17 namespace tracked_objects { |
| 18 | 18 |
| 19 // A TLS slot to the TrackRegistry for the current thread. | 19 // A TLS slot to the TrackRegistry for the current thread. |
| 20 // static | 20 // static |
| 21 TLSSlot ThreadData::tls_index_(base::LINKER_INITIALIZED); | 21 base::ThreadLocalStorage::Slot ThreadData::tls_index_(base::LINKER_INITIALIZED); |
| 22 | 22 |
| 23 // A global state variable to prevent repeated initialization during tests. | 23 // A global state variable to prevent repeated initialization during tests. |
| 24 // static | 24 // static |
| 25 AutoTracking::State AutoTracking::state_ = AutoTracking::kNeverBeenRun; | 25 AutoTracking::State AutoTracking::state_ = AutoTracking::kNeverBeenRun; |
| 26 | 26 |
| 27 //------------------------------------------------------------------------------ | 27 //------------------------------------------------------------------------------ |
| 28 // Death data tallies durations when a death takes place. | 28 // Death data tallies durations when a death takes place. |
| 29 | 29 |
| 30 void DeathData::RecordDeath(const TimeDelta& duration) { | 30 void DeathData::RecordDeath(const TimeDelta& duration) { |
| 31 ++count_; | 31 ++count_; |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 1049 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
| 1050 sample.birth().birth_thread()->ThreadName().c_str(), | 1050 sample.birth().birth_thread()->ThreadName().c_str(), |
| 1051 (combined_selectors_ & DEATH_THREAD) ? "*" : | 1051 (combined_selectors_ & DEATH_THREAD) ? "*" : |
| 1052 sample.DeathThreadName().c_str()); | 1052 sample.DeathThreadName().c_str()); |
| 1053 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 1053 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
| 1054 !(combined_selectors_ & BIRTH_FUNCTION), | 1054 !(combined_selectors_ & BIRTH_FUNCTION), |
| 1055 output); | 1055 output); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 } // namespace tracked_objects | 1058 } // namespace tracked_objects |
| OLD | NEW |