| 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 #ifndef BASE_DEBUG_PROFILER_H_ | 5 #ifndef BASE_DEBUG_PROFILER_H_ |
| 6 #define BASE_DEBUG_PROFILER_H_ | 6 #define BASE_DEBUG_PROFILER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Returns true if process is being profiled. | 32 // Returns true if process is being profiled. |
| 33 BASE_EXPORT bool BeingProfiled(); | 33 BASE_EXPORT bool BeingProfiled(); |
| 34 | 34 |
| 35 // Reset profiling after a fork, which disables timers. | 35 // Reset profiling after a fork, which disables timers. |
| 36 BASE_EXPORT void RestartProfilingAfterFork(); | 36 BASE_EXPORT void RestartProfilingAfterFork(); |
| 37 | 37 |
| 38 // Returns true iff this executable is instrumented with the Syzygy profiler. | 38 // Returns true iff this executable is instrumented with the Syzygy profiler. |
| 39 BASE_EXPORT bool IsBinaryInstrumented(); | 39 BASE_EXPORT bool IsBinaryInstrumented(); |
| 40 | 40 |
| 41 // Returns true iff this executable supports profiling. |
| 42 BASE_EXPORT bool IsProfilingSupported(); |
| 43 |
| 41 // There's a class of profilers that use "return address swizzling" to get a | 44 // There's a class of profilers that use "return address swizzling" to get a |
| 42 // hook on function exits. This class of profilers uses some form of entry hook, | 45 // hook on function exits. This class of profilers uses some form of entry hook, |
| 43 // like e.g. binary instrumentation, or a compiler flag, that calls a hook each | 46 // like e.g. binary instrumentation, or a compiler flag, that calls a hook each |
| 44 // time a function is invoked. The hook then switches the return address on the | 47 // time a function is invoked. The hook then switches the return address on the |
| 45 // stack for the address of an exit hook function, and pushes the original | 48 // stack for the address of an exit hook function, and pushes the original |
| 46 // return address to a shadow stack of some type. When in due course the CPU | 49 // return address to a shadow stack of some type. When in due course the CPU |
| 47 // executes a return to the exit hook, the exit hook will do whatever work it | 50 // executes a return to the exit hook, the exit hook will do whatever work it |
| 48 // does on function exit, then arrange to return to the original return address. | 51 // does on function exit, then arrange to return to the original return address. |
| 49 // This class of profiler does not play well with programs that look at the | 52 // This class of profiler does not play well with programs that look at the |
| 50 // return address, as does e.g. V8. V8 uses the return address to certain | 53 // return address, as does e.g. V8. V8 uses the return address to certain |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Otherwise returns NULL. | 85 // Otherwise returns NULL. |
| 83 BASE_EXPORT ReturnAddressLocationResolver GetProfilerReturnAddrResolutionFunc(); | 86 BASE_EXPORT ReturnAddressLocationResolver GetProfilerReturnAddrResolutionFunc(); |
| 84 BASE_EXPORT DynamicFunctionEntryHook GetProfilerDynamicFunctionEntryHookFunc(); | 87 BASE_EXPORT DynamicFunctionEntryHook GetProfilerDynamicFunctionEntryHookFunc(); |
| 85 BASE_EXPORT AddDynamicSymbol GetProfilerAddDynamicSymbolFunc(); | 88 BASE_EXPORT AddDynamicSymbol GetProfilerAddDynamicSymbolFunc(); |
| 86 BASE_EXPORT MoveDynamicSymbol GetProfilerMoveDynamicSymbolFunc(); | 89 BASE_EXPORT MoveDynamicSymbol GetProfilerMoveDynamicSymbolFunc(); |
| 87 | 90 |
| 88 } // namespace debug | 91 } // namespace debug |
| 89 } // namespace base | 92 } // namespace base |
| 90 | 93 |
| 91 #endif // BASE_DEBUG_PROFILER_H_ | 94 #endif // BASE_DEBUG_PROFILER_H_ |
| OLD | NEW |