| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // this command-line flag to the "off" value if it's not specified. | 69 // this command-line flag to the "off" value if it's not specified. |
| 70 // This in turn can be overridden by explicitly calling | 70 // This in turn can be overridden by explicitly calling |
| 71 // ThreadData::EnableProfilerTiming, say, based on a field trial. | 71 // ThreadData::EnableProfilerTiming, say, based on a field trial. |
| 72 inline bool IsProfilerTimingEnabled() { | 72 inline bool IsProfilerTimingEnabled() { |
| 73 // Reading |g_profiler_timing_enabled| is done without barrier because | 73 // Reading |g_profiler_timing_enabled| is done without barrier because |
| 74 // multiple initialization is not an issue while the barrier can be relatively | 74 // multiple initialization is not an issue while the barrier can be relatively |
| 75 // costly given that this method is sometimes called in a tight loop. | 75 // costly given that this method is sometimes called in a tight loop. |
| 76 base::subtle::Atomic32 current_timing_enabled = | 76 base::subtle::Atomic32 current_timing_enabled = |
| 77 base::subtle::NoBarrier_Load(&g_profiler_timing_enabled); | 77 base::subtle::NoBarrier_Load(&g_profiler_timing_enabled); |
| 78 if (current_timing_enabled == UNDEFINED_TIMING) { | 78 if (current_timing_enabled == UNDEFINED_TIMING) { |
| 79 if (!CommandLine::InitializedForCurrentProcess()) | 79 if (!base::CommandLine::InitializedForCurrentProcess()) |
| 80 return true; | 80 return true; |
| 81 current_timing_enabled = | 81 current_timing_enabled = |
| 82 (CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 82 (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 83 switches::kProfilerTiming) == | 83 switches::kProfilerTiming) == |
| 84 switches::kProfilerTimingDisabledValue) | 84 switches::kProfilerTimingDisabledValue) |
| 85 ? DISABLED_TIMING | 85 ? DISABLED_TIMING |
| 86 : ENABLED_TIMING; | 86 : ENABLED_TIMING; |
| 87 base::subtle::NoBarrier_Store(&g_profiler_timing_enabled, | 87 base::subtle::NoBarrier_Store(&g_profiler_timing_enabled, |
| 88 current_timing_enabled); | 88 current_timing_enabled); |
| 89 } | 89 } |
| 90 return current_timing_enabled == ENABLED_TIMING; | 90 return current_timing_enabled == ENABLED_TIMING; |
| 91 } | 91 } |
| 92 | 92 |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 : process_id(base::GetCurrentProcId()) { | 1000 : process_id(base::GetCurrentProcId()) { |
| 1001 #else | 1001 #else |
| 1002 : process_id(0) { | 1002 : process_id(0) { |
| 1003 #endif | 1003 #endif |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 ProcessDataSnapshot::~ProcessDataSnapshot() { | 1006 ProcessDataSnapshot::~ProcessDataSnapshot() { |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 } // namespace tracked_objects | 1009 } // namespace tracked_objects |
| OLD | NEW |