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

Side by Side Diff: base/tracked_objects.h

Issue 980333004: Removing unused Births methods and unnecessary link from chrome://profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reset_max
Patch Set: 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
« no previous file with comments | « no previous file | base/tracked_objects.cc » ('j') | 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>
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 class BASE_EXPORT Births: public BirthOnThread { 234 class BASE_EXPORT Births: public BirthOnThread {
235 public: 235 public:
236 Births(const Location& location, const ThreadData& current); 236 Births(const Location& location, const ThreadData& current);
237 237
238 int birth_count() const; 238 int birth_count() const;
239 239
240 // When we have a birth we update the count for this birthplace. 240 // When we have a birth we update the count for this birthplace.
241 void RecordBirth(); 241 void RecordBirth();
242 242
243 // When a birthplace is changed (updated), we need to decrement the counter
244 // for the old instance.
245 void ForgetBirth();
246
247 // Hack to quickly reset all counts to zero.
248 void Clear();
249
250 private: 243 private:
251 // The number of births on this thread for our location_. 244 // The number of births on this thread for our location_.
252 int birth_count_; 245 int birth_count_;
253 246
254 DISALLOW_COPY_AND_ASSIGN(Births); 247 DISALLOW_COPY_AND_ASSIGN(Births);
255 }; 248 };
256 249
257 //------------------------------------------------------------------------------ 250 //------------------------------------------------------------------------------
258 // Basic info summarizing multiple destructions of a tracked object with a 251 // Basic info summarizing multiple destructions of a tracked object with a
259 // single birthplace (fixed Location). Used both on specific threads, and also 252 // single birthplace (fixed Location). Used both on specific threads, and also
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 const TaskStopwatch& stopwatch); 408 const TaskStopwatch& stopwatch);
416 409
417 // Record the end of execution in region, generally corresponding to a scope 410 // Record the end of execution in region, generally corresponding to a scope
418 // being exited. 411 // being exited.
419 static void TallyRunInAScopedRegionIfTracking( 412 static void TallyRunInAScopedRegionIfTracking(
420 const Births* birth, 413 const Births* birth,
421 const TaskStopwatch& stopwatch); 414 const TaskStopwatch& stopwatch);
422 415
423 const std::string& thread_name() const { return thread_name_; } 416 const std::string& thread_name() const { return thread_name_; }
424 417
425 // Hack: asynchronously clear all birth counts and death tallies data values
426 // in all ThreadData instances. The numerical (zeroing) part is done without
427 // use of a locks or atomics exchanges, and may (for int64 values) produce
428 // bogus counts VERY rarely.
429 static void ResetAllThreadData();
430
431 // Initializes all statics if needed (this initialization call should be made 418 // Initializes all statics if needed (this initialization call should be made
432 // while we are single threaded). Returns false if unable to initialize. 419 // while we are single threaded). Returns false if unable to initialize.
433 static bool Initialize(); 420 static bool Initialize();
434 421
435 // Sets internal status_. 422 // Sets internal status_.
436 // If |status| is false, then status_ is set to DEACTIVATED. 423 // If |status| is false, then status_ is set to DEACTIVATED.
437 // If |status| is true, then status_ is set to, PROFILING_ACTIVE, or 424 // If |status| is true, then status_ is set to, PROFILING_ACTIVE, or
438 // PROFILING_CHILDREN_ACTIVE. 425 // PROFILING_CHILDREN_ACTIVE.
439 // If tracking is not compiled in, this function will return false. 426 // If tracking is not compiled in, this function will return false.
440 // If parent-child tracking is not compiled in, then an attempt to set the 427 // If parent-child tracking is not compiled in, then an attempt to set the
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 void SnapshotExecutedTasks(ProcessDataSnapshot* process_data, 525 void SnapshotExecutedTasks(ProcessDataSnapshot* process_data,
539 BirthCountMap* birth_counts); 526 BirthCountMap* birth_counts);
540 527
541 // Using our lock, make a copy of the specified maps. This call may be made 528 // Using our lock, make a copy of the specified maps. This call may be made
542 // on non-local threads, which necessitate the use of the lock to prevent 529 // on non-local threads, which necessitate the use of the lock to prevent
543 // the map(s) from being reallocated while they are copied. 530 // the map(s) from being reallocated while they are copied.
544 void SnapshotMaps(BirthMap* birth_map, 531 void SnapshotMaps(BirthMap* birth_map,
545 DeathMap* death_map, 532 DeathMap* death_map,
546 ParentChildSet* parent_child_set); 533 ParentChildSet* parent_child_set);
547 534
548 // Using our lock to protect the iteration, Clear all birth and death data.
549 void Reset();
550
551 // This method is called by the TLS system when a thread terminates. 535 // This method is called by the TLS system when a thread terminates.
552 // The argument may be NULL if this thread has never tracked a birth or death. 536 // The argument may be NULL if this thread has never tracked a birth or death.
553 static void OnThreadTermination(void* thread_data); 537 static void OnThreadTermination(void* thread_data);
554 538
555 // This method should be called when a worker thread terminates, so that we 539 // This method should be called when a worker thread terminates, so that we
556 // can save all the thread data into a cache of reusable ThreadData instances. 540 // can save all the thread data into a cache of reusable ThreadData instances.
557 void OnThreadTerminationCleanup(); 541 void OnThreadTerminationCleanup();
558 542
559 // Cleans up data structures, and returns statics to near pristine (mostly 543 // Cleans up data structures, and returns statics to near pristine (mostly
560 // uninitialized) state. If there is any chance that other threads are still 544 // uninitialized) state. If there is any chance that other threads are still
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 ~ProcessDataSnapshot(); 754 ~ProcessDataSnapshot();
771 755
772 std::vector<TaskSnapshot> tasks; 756 std::vector<TaskSnapshot> tasks;
773 std::vector<ParentChildPairSnapshot> descendants; 757 std::vector<ParentChildPairSnapshot> descendants;
774 int process_id; 758 int process_id;
775 }; 759 };
776 760
777 } // namespace tracked_objects 761 } // namespace tracked_objects
778 762
779 #endif // BASE_TRACKED_OBJECTS_H_ 763 #endif // BASE_TRACKED_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | base/tracked_objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698