| OLD | NEW |
| 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 #ifndef BASE_TRACKED_OBJECTS_H_ | 5 #ifndef BASE_TRACKED_OBJECTS_H_ |
| 6 #define BASE_TRACKED_OBJECTS_H_ | 6 #define BASE_TRACKED_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <stack> | 10 #include <stack> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/base_export.h" | 15 #include "base/base_export.h" |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/containers/hash_tables.h" |
| 17 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 18 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 19 #include "base/location.h" | 20 #include "base/location.h" |
| 20 #include "base/profiler/alternate_timer.h" | 21 #include "base/profiler/alternate_timer.h" |
| 21 #include "base/profiler/tracked_time.h" | 22 #include "base/profiler/tracked_time.h" |
| 22 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
| 23 #include "base/threading/thread_local_storage.h" | 24 #include "base/threading/thread_local_storage.h" |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 struct TrackingInfo; | 27 struct TrackingInfo; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // between ACTIVE and DEACTIVATED, but can never go back to UNINITIALIZED. | 351 // between ACTIVE and DEACTIVATED, but can never go back to UNINITIALIZED. |
| 351 enum Status { | 352 enum Status { |
| 352 UNINITIALIZED, // PRistine, link-time state before running. | 353 UNINITIALIZED, // PRistine, link-time state before running. |
| 353 DORMANT_DURING_TESTS, // Only used during testing. | 354 DORMANT_DURING_TESTS, // Only used during testing. |
| 354 DEACTIVATED, // No longer recording profiling. | 355 DEACTIVATED, // No longer recording profiling. |
| 355 PROFILING_ACTIVE, // Recording profiles (no parent-child links). | 356 PROFILING_ACTIVE, // Recording profiles (no parent-child links). |
| 356 PROFILING_CHILDREN_ACTIVE, // Fully active, recording parent-child links. | 357 PROFILING_CHILDREN_ACTIVE, // Fully active, recording parent-child links. |
| 357 STATUS_LAST = PROFILING_CHILDREN_ACTIVE | 358 STATUS_LAST = PROFILING_CHILDREN_ACTIVE |
| 358 }; | 359 }; |
| 359 | 360 |
| 360 typedef std::map<Location, Births*> BirthMap; | 361 typedef base::hash_map<Location, Births*, Location::Hash> BirthMap; |
| 361 typedef std::map<const Births*, DeathData> DeathMap; | 362 typedef std::map<const Births*, DeathData> DeathMap; |
| 362 typedef std::pair<const Births*, const Births*> ParentChildPair; | 363 typedef std::pair<const Births*, const Births*> ParentChildPair; |
| 363 typedef std::set<ParentChildPair> ParentChildSet; | 364 typedef std::set<ParentChildPair> ParentChildSet; |
| 364 typedef std::stack<const Births*> ParentStack; | 365 typedef std::stack<const Births*> ParentStack; |
| 365 | 366 |
| 366 // Initialize the current thread context with a new instance of ThreadData. | 367 // Initialize the current thread context with a new instance of ThreadData. |
| 367 // This is used by all threads that have names, and should be explicitly | 368 // This is used by all threads that have names, and should be explicitly |
| 368 // set *before* any births on the threads have taken place. It is generally | 369 // set *before* any births on the threads have taken place. It is generally |
| 369 // only used by the message loop, which has a well defined thread name. | 370 // only used by the message loop, which has a well defined thread name. |
| 370 static void InitializeThreadContext(const std::string& suggested_name); | 371 static void InitializeThreadContext(const std::string& suggested_name); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 ~ProcessDataSnapshot(); | 755 ~ProcessDataSnapshot(); |
| 755 | 756 |
| 756 std::vector<TaskSnapshot> tasks; | 757 std::vector<TaskSnapshot> tasks; |
| 757 std::vector<ParentChildPairSnapshot> descendants; | 758 std::vector<ParentChildPairSnapshot> descendants; |
| 758 int process_id; | 759 int process_id; |
| 759 }; | 760 }; |
| 760 | 761 |
| 761 } // namespace tracked_objects | 762 } // namespace tracked_objects |
| 762 | 763 |
| 763 #endif // BASE_TRACKED_OBJECTS_H_ | 764 #endif // BASE_TRACKED_OBJECTS_H_ |
| OLD | NEW |