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

Side by Side Diff: base/debug/profiler.h

Issue 9477002: Support the Syzygy instrumenting profiler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address Jim's comments. Created 8 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/debug/profiler.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 // Force data to be written to file. 28 // Force data to be written to file.
29 BASE_EXPORT void FlushProfiling(); 29 BASE_EXPORT void FlushProfiling();
30 30
31 // Returns true if process is being profiled. 31 // Returns true if process is being profiled.
32 BASE_EXPORT bool BeingProfiled(); 32 BASE_EXPORT bool BeingProfiled();
33 33
34 // Reset profiling after a fork, which disables timers. 34 // Reset profiling after a fork, which disables timers.
35 BASE_EXPORT void RestartProfilingAfterFork(); 35 BASE_EXPORT void RestartProfilingAfterFork();
36 36
37 // Returns true iff this executable is instrumented with the Syzygy profiler.
38 BASE_EXPORT bool IsBinaryInstrumented();
39
40 // There's a class of profilers that use "return address swizzling" to get a
41 // hook on function exits. This class of profilers uses some form of entry hook,
42 // like e.g. binary instrumentation, or a compiler flag, that calls a hook each
43 // time a function is invoked. The hook then switches the return address on the
44 // stack for the address of an exit hook function, and pushes the original
45 // return address to a shadow stack of some type. When in due course the CPU
46 // executes a return to the exit hook, the exit hook will do whatever work it
47 // does on function exit, then arrange to return to the original return address.
48 // This class of profiler does not play well with programs that look at the
49 // return address, as does e.g. V8. V8 uses the return address to certain
50 // runtime functions to find the JIT code that called it, and from there finds
51 // the V8 data structures associated to the JS function involved.
52 // A return address resolution function is used to fix this. It allows such
53 // programs to resolve a location on stack where a return address originally
54 // resided, to the shadow stack location where the profiler stashed it.
jar (doing other things) 2012/02/28 17:16:21 Much better!!!! Thanks!
55 typedef uintptr_t (*ReturnAddressLocationResolver)(
56 uintptr_t return_addr_location);
57
58 // If this binary is instrumented and the instrumentation supplies a return
59 // address resolution function, finds and returns the address resolution
60 // function. Otherwise returns NULL.
61 BASE_EXPORT ReturnAddressLocationResolver
62 GetProfilerReturnAddrResolutionFunc();
63
37 } // namespace debug 64 } // namespace debug
38 } // namespace base 65 } // namespace base
39 66
40 #endif // BASE_DEBUG_DEBUGGER_H 67 #endif // BASE_DEBUG_DEBUGGER_H
OLDNEW
« no previous file with comments | « no previous file | base/debug/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698