| 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 #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/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/third_party/valgrind/memcheck.h" | 12 #include "base/third_party/valgrind/memcheck.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "base/port.h" | 15 #include "base/port.h" |
| 16 | 16 |
| 17 using base::TimeDelta; | 17 using base::TimeDelta; |
| 18 | 18 |
| 19 namespace tracked_objects { | 19 namespace tracked_objects { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 |
| 22 // Flag to compile out almost all of the task tracking code. | 23 // Flag to compile out almost all of the task tracking code. |
| 23 static const bool kTrackAllTaskObjects = true; | 24 const bool kTrackAllTaskObjects = true; |
| 24 | 25 |
| 25 // Flag to compile out parent-child link recording. | 26 // Flag to compile out parent-child link recording. |
| 26 static const bool kTrackParentChildLinks = false; | 27 const bool kTrackParentChildLinks = false; |
| 27 | 28 |
| 28 // When ThreadData is first initialized, should we start in an ACTIVE state to | 29 // When ThreadData is first initialized, should we start in an ACTIVE state to |
| 29 // record all of the startup-time tasks, or should we start up DEACTIVATED, so | 30 // record all of the startup-time tasks, or should we start up DEACTIVATED, so |
| 30 // that we only record after parsing the command line flag --enable-tracking. | 31 // that we only record after parsing the command line flag --enable-tracking. |
| 31 // Note that the flag may force either state, so this really controls only the | 32 // Note that the flag may force either state, so this really controls only the |
| 32 // period of time up until that flag is parsed. If there is no flag seen, then | 33 // period of time up until that flag is parsed. If there is no flag seen, then |
| 33 // this state may prevail for much or all of the process lifetime. | 34 // this state may prevail for much or all of the process lifetime. |
| 34 static const ThreadData::Status kInitialStartupState = | 35 const ThreadData::Status kInitialStartupState = |
| 35 ThreadData::PROFILING_CHILDREN_ACTIVE; | 36 ThreadData::PROFILING_CHILDREN_ACTIVE; |
| 37 |
| 36 } // namespace | 38 } // namespace |
| 37 | 39 |
| 38 //------------------------------------------------------------------------------ | 40 //------------------------------------------------------------------------------ |
| 39 // DeathData tallies durations when a death takes place. | 41 // DeathData tallies durations when a death takes place. |
| 40 | 42 |
| 41 DeathData::DeathData() { | 43 DeathData::DeathData() { |
| 42 Clear(); | 44 Clear(); |
| 43 } | 45 } |
| 44 | 46 |
| 45 DeathData::DeathData(int count) { | 47 DeathData::DeathData(int count) { |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 ++it) { | 827 ++it) { |
| 826 base::DictionaryValue* parent_child = new base::DictionaryValue; | 828 base::DictionaryValue* parent_child = new base::DictionaryValue; |
| 827 it->first->ToValue("parent", parent_child); | 829 it->first->ToValue("parent", parent_child); |
| 828 it->second->ToValue("child", parent_child); | 830 it->second->ToValue("child", parent_child); |
| 829 descendants->Append(parent_child); | 831 descendants->Append(parent_child); |
| 830 } | 832 } |
| 831 dictionary->Set("descendants", descendants); | 833 dictionary->Set("descendants", descendants); |
| 832 } | 834 } |
| 833 | 835 |
| 834 } // namespace tracked_objects | 836 } // namespace tracked_objects |
| OLD | NEW |