3 //base/profiler implements a
4 [statistical profiler](https://en.wikipedia.org/wiki/Profiling_(computer_programming)#Statistical_profilers)
5 for Chrome execution. It supports periodic sampling of thread stacks for the
6 purpose of understanding how frequently different parts of the Chrome code are
7 being executed. The profiler is used to collect execution information by UMA,
8 for broad-scale profiling, and by Chrometto, for targeted profiling during
14 The primary entry point to this code is
15 [StackSamplingProfiler](stack_sampling_profiler.h). This class regularly
16 records the list of currently executing functions on a target thread. See
17 the comments above that function for an overview of how to use the profiler.
19 The details are very platform-specific, but the major sub-components are
21 * A dedicated thread is created to periodically wake up and sample the target
22 thread. At each wake up:
23 * A [StackCopier](stack_copier.h) copies the target thread's stack
24 memory into a [StackBuffer](stack_buffer.h).
25 * One or more [Unwinders](unwinder.h) take the memory blob in the StackBuffer
26 and turn it into a list of function [Frames](frame.h). Every platform has
27 a native unwinder to deal with C++ frames; there are also unwinders for
28 V8's special frame layout and for Java frames.
29 * Frames have the function instruction address and some module information
30 from [ModuleCache](module_cache.h). This should be enough for a program
31 with access to the original debug information to reconstruct the names of
32 the functions in the stack. The actual conversion back to human-readable
33 names is not part of this directory's code.
34 * A subclass of [ProfileBuilder](profile_builder.h) is called with a vector
35 of Frames corresponding to one stack. The various users of this code are
36 responsible for implementing this subclass and recording the stacks in the