| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 430 |
| 431 // Map from profiling phase number to the process-wide snapshotted | 431 // Map from profiling phase number to the process-wide snapshotted |
| 432 // representation of the list of ThreadData objects that died during the given | 432 // representation of the list of ThreadData objects that died during the given |
| 433 // phase. | 433 // phase. |
| 434 typedef std::map<int, ProcessDataPhaseSnapshot> PhasedProcessDataSnapshotMap; | 434 typedef std::map<int, ProcessDataPhaseSnapshot> PhasedProcessDataSnapshotMap; |
| 435 | 435 |
| 436 class BASE_EXPORT ThreadData { | 436 class BASE_EXPORT ThreadData { |
| 437 public: | 437 public: |
| 438 // Current allowable states of the tracking system. The states can vary | 438 // Current allowable states of the tracking system. The states can vary |
| 439 // between ACTIVE and DEACTIVATED, but can never go back to UNINITIALIZED. | 439 // between ACTIVE and DEACTIVATED, but can never go back to UNINITIALIZED. |
| 440 enum Status { | 440 enum ThreadStatus { |
| 441 UNINITIALIZED, // Pristine, link-time state before running. | 441 UNINITIALIZED, // Pristine, link-time state before running. |
| 442 DORMANT_DURING_TESTS, // Only used during testing. | 442 DORMANT_DURING_TESTS, // Only used during testing. |
| 443 DEACTIVATED, // No longer recording profiling. | 443 DEACTIVATED, // No longer recording profiling. |
| 444 PROFILING_ACTIVE, // Recording profiles. | 444 PROFILING_ACTIVE, // Recording profiles. |
| 445 STATUS_LAST = PROFILING_ACTIVE | 445 STATUS_LAST = PROFILING_ACTIVE |
| 446 }; | 446 }; |
| 447 | 447 |
| 448 typedef base::hash_map<Location, Births*, Location::Hash> BirthMap; | 448 typedef base::hash_map<Location, Births*, Location::Hash> BirthMap; |
| 449 typedef std::map<const Births*, DeathData> DeathMap; | 449 typedef std::map<const Births*, DeathData> DeathMap; |
| 450 | 450 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 | 512 |
| 513 const std::string& thread_name() const { return thread_name_; } | 513 const std::string& thread_name() const { return thread_name_; } |
| 514 | 514 |
| 515 // Initializes all statics if needed (this initialization call should be made | 515 // Initializes all statics if needed (this initialization call should be made |
| 516 // while we are single threaded). | 516 // while we are single threaded). |
| 517 static void Initialize(); | 517 static void Initialize(); |
| 518 | 518 |
| 519 // Sets internal status_. | 519 // Sets internal status_. |
| 520 // If |status| is false, then status_ is set to DEACTIVATED. | 520 // If |status| is false, then status_ is set to DEACTIVATED. |
| 521 // If |status| is true, then status_ is set to PROFILING_ACTIVE. | 521 // If |status| is true, then status_ is set to PROFILING_ACTIVE. |
| 522 static void InitializeAndSetTrackingStatus(Status status); | 522 static void InitializeAndSetTrackingStatus(ThreadStatus status); |
| 523 | 523 |
| 524 static Status status(); | 524 static ThreadStatus status(); |
| 525 | 525 |
| 526 // Indicate if any sort of profiling is being done (i.e., we are more than | 526 // Indicate if any sort of profiling is being done (i.e., we are more than |
| 527 // DEACTIVATED). | 527 // DEACTIVATED). |
| 528 static bool TrackingStatus(); | 528 static bool TrackingStatus(); |
| 529 | 529 |
| 530 // Enables profiler timing. | 530 // Enables profiler timing. |
| 531 static void EnableProfilerTiming(); | 531 static void EnableProfilerTiming(); |
| 532 | 532 |
| 533 // Provide a time function that does nothing (runs fast) when we don't have | 533 // Provide a time function that does nothing (runs fast) when we don't have |
| 534 // the profiler enabled. It will generally be optimized away when it is | 534 // the profiler enabled. It will generally be optimized away when it is |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 ProcessDataSnapshot(const ProcessDataSnapshot& other); | 811 ProcessDataSnapshot(const ProcessDataSnapshot& other); |
| 812 ~ProcessDataSnapshot(); | 812 ~ProcessDataSnapshot(); |
| 813 | 813 |
| 814 PhasedProcessDataSnapshotMap phased_snapshots; | 814 PhasedProcessDataSnapshotMap phased_snapshots; |
| 815 base::ProcessId process_id; | 815 base::ProcessId process_id; |
| 816 }; | 816 }; |
| 817 | 817 |
| 818 } // namespace tracked_objects | 818 } // namespace tracked_objects |
| 819 | 819 |
| 820 #endif // BASE_TRACKED_OBJECTS_H_ | 820 #endif // BASE_TRACKED_OBJECTS_H_ |
| OLD | NEW |