| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ENABLED_TIMING, | 60 ENABLED_TIMING, |
| 61 DISABLED_TIMING, | 61 DISABLED_TIMING, |
| 62 }; | 62 }; |
| 63 static base::subtle::Atomic32 timing_enabled = UNDEFINED_TIMING; | 63 static base::subtle::Atomic32 timing_enabled = UNDEFINED_TIMING; |
| 64 // Reading |timing_enabled| is done without barrier because multiple | 64 // Reading |timing_enabled| is done without barrier because multiple |
| 65 // initialization is not an issue while the barrier can be relatively costly | 65 // initialization is not an issue while the barrier can be relatively costly |
| 66 // given that this method is sometimes called in a tight loop. | 66 // given that this method is sometimes called in a tight loop. |
| 67 base::subtle::Atomic32 current_timing_enabled = | 67 base::subtle::Atomic32 current_timing_enabled = |
| 68 base::subtle::NoBarrier_Load(&timing_enabled); | 68 base::subtle::NoBarrier_Load(&timing_enabled); |
| 69 if (current_timing_enabled == UNDEFINED_TIMING) { | 69 if (current_timing_enabled == UNDEFINED_TIMING) { |
| 70 if (!CommandLine::InitializedForCurrentProcess()) | 70 if (!base::CommandLine::InitializedForCurrentProcess()) |
| 71 return true; | 71 return true; |
| 72 current_timing_enabled = | 72 current_timing_enabled = |
| 73 (CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 73 (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 74 switches::kProfilerTiming) == | 74 switches::kProfilerTiming) == |
| 75 switches::kProfilerTimingDisabledValue) | 75 switches::kProfilerTimingDisabledValue) |
| 76 ? DISABLED_TIMING | 76 ? DISABLED_TIMING |
| 77 : ENABLED_TIMING; | 77 : ENABLED_TIMING; |
| 78 base::subtle::NoBarrier_Store(&timing_enabled, current_timing_enabled); | 78 base::subtle::NoBarrier_Store(&timing_enabled, current_timing_enabled); |
| 79 } | 79 } |
| 80 return current_timing_enabled == ENABLED_TIMING; | 80 return current_timing_enabled == ENABLED_TIMING; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 : process_id(base::GetCurrentProcId()) { | 969 : process_id(base::GetCurrentProcId()) { |
| 970 #else | 970 #else |
| 971 : process_id(0) { | 971 : process_id(0) { |
| 972 #endif | 972 #endif |
| 973 } | 973 } |
| 974 | 974 |
| 975 ProcessDataSnapshot::~ProcessDataSnapshot() { | 975 ProcessDataSnapshot::~ProcessDataSnapshot() { |
| 976 } | 976 } |
| 977 | 977 |
| 978 } // namespace tracked_objects | 978 } // namespace tracked_objects |
| OLD | NEW |