Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: base/tracked_objects.h

Issue 957573002: Use hash map for tracked_objects::location (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicitly cast line number to uint32_t Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« base/location.h ('K') | « base/location.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // between ACTIVE and DEACTIVATED, but can never go back to UNINITIALIZED. 358 // between ACTIVE and DEACTIVATED, but can never go back to UNINITIALIZED.
358 enum Status { 359 enum Status {
359 UNINITIALIZED, // PRistine, link-time state before running. 360 UNINITIALIZED, // PRistine, link-time state before running.
360 DORMANT_DURING_TESTS, // Only used during testing. 361 DORMANT_DURING_TESTS, // Only used during testing.
361 DEACTIVATED, // No longer recording profiling. 362 DEACTIVATED, // No longer recording profiling.
362 PROFILING_ACTIVE, // Recording profiles (no parent-child links). 363 PROFILING_ACTIVE, // Recording profiles (no parent-child links).
363 PROFILING_CHILDREN_ACTIVE, // Fully active, recording parent-child links. 364 PROFILING_CHILDREN_ACTIVE, // Fully active, recording parent-child links.
364 STATUS_LAST = PROFILING_CHILDREN_ACTIVE 365 STATUS_LAST = PROFILING_CHILDREN_ACTIVE
365 }; 366 };
366 367
367 typedef std::map<Location, Births*> BirthMap; 368 typedef base::hash_map<Location, Births*, Location::Hash> BirthMap;
368 typedef std::map<const Births*, DeathData> DeathMap; 369 typedef std::map<const Births*, DeathData> DeathMap;
369 typedef std::pair<const Births*, const Births*> ParentChildPair; 370 typedef std::pair<const Births*, const Births*> ParentChildPair;
370 typedef std::set<ParentChildPair> ParentChildSet; 371 typedef std::set<ParentChildPair> ParentChildSet;
371 typedef std::stack<const Births*> ParentStack; 372 typedef std::stack<const Births*> ParentStack;
372 373
373 // Initialize the current thread context with a new instance of ThreadData. 374 // Initialize the current thread context with a new instance of ThreadData.
374 // This is used by all threads that have names, and should be explicitly 375 // This is used by all threads that have names, and should be explicitly
375 // set *before* any births on the threads have taken place. It is generally 376 // set *before* any births on the threads have taken place. It is generally
376 // only used by the message loop, which has a well defined thread name. 377 // only used by the message loop, which has a well defined thread name.
377 static void InitializeThreadContext(const std::string& suggested_name); 378 static void InitializeThreadContext(const std::string& suggested_name);
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 ~ProcessDataSnapshot(); 771 ~ProcessDataSnapshot();
771 772
772 std::vector<TaskSnapshot> tasks; 773 std::vector<TaskSnapshot> tasks;
773 std::vector<ParentChildPairSnapshot> descendants; 774 std::vector<ParentChildPairSnapshot> descendants;
774 int process_id; 775 int process_id;
775 }; 776 };
776 777
777 } // namespace tracked_objects 778 } // namespace tracked_objects
778 779
779 #endif // BASE_TRACKED_OBJECTS_H_ 780 #endif // BASE_TRACKED_OBJECTS_H_
OLDNEW
« base/location.h ('K') | « base/location.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698