blob: 9bbe1345d2d99ecef801cb6eea28751776d86cc1 [file] [log] [blame]
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +01001.. SPDX-License-Identifier: GPL-2.0+
2.. Copyright (c) 2013 The Chromium OS Authors.
Simon Glassb2e16a82013-06-11 11:14:39 -07003
4Tracing in U-Boot
5=================
6
Heinrich Schuchardt3f800642021-11-16 18:38:47 +01007U-Boot supports a simple tracing feature which allows a record of execution
Simon Glassb2e16a82013-06-11 11:14:39 -07008to be collected and sent to a host machine for analysis. At present the
9main use for this is to profile boot time.
10
11
12Overview
13--------
14
15The trace feature uses GCC's instrument-functions feature to trace all
16function entry/exit points. These are then recorded in a memory buffer.
17The memory buffer can be saved to the host over a network link using
Simon Glasse46b7242023-01-15 14:16:01 -070018tftpput or by writing to an attached storage device such as MMC.
Simon Glassb2e16a82013-06-11 11:14:39 -070019
20On the host, the file is first converted with a tool called 'proftool',
21which extracts useful information from it. The resulting trace output
22resembles that emitted by Linux's ftrace feature, so can be visually
Simon Glasse46b7242023-01-15 14:16:01 -070023displayed by kernelshark (see kernelshark_) and used with
24'trace-cmd report' (see trace_cmd_).
25
26It is also possible to produce a flame graph for use with flamegraph.pl
27(see flamegraph_pl_).
Simon Glassb2e16a82013-06-11 11:14:39 -070028
29
30Quick-start using Sandbox
31-------------------------
32
33Sandbox is a build of U-Boot that can run under Linux so it is a convenient
34way of trying out tracing before you use it on your actual board. To do
35this, follow these steps:
36
Simon Glasse46b7242023-01-15 14:16:01 -070037Add the following to `config/sandbox_defconfig`:
Simon Glassb2e16a82013-06-11 11:14:39 -070038
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010039.. code-block:: c
40
Simon Glass89050242021-11-24 09:26:39 -070041 CONFIG_TRACE=y
Simon Glassb2e16a82013-06-11 11:14:39 -070042
43Build sandbox U-Boot with tracing enabled:
44
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010045.. code-block:: console
46
47 $ make FTRACE=1 O=sandbox sandbox_config
48 $ make FTRACE=1 O=sandbox
Simon Glassb2e16a82013-06-11 11:14:39 -070049
50Run sandbox, wait for a bit of trace information to appear, and then capture
51a trace:
52
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010053.. code-block:: console
Simon Glassb2e16a82013-06-11 11:14:39 -070054
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010055 $ ./sandbox/u-boot
Simon Glassb2e16a82013-06-11 11:14:39 -070056
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010057 U-Boot 2013.04-rc2-00100-ga72fcef (Apr 17 2013 - 19:25:24)
Simon Glassb2e16a82013-06-11 11:14:39 -070058
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010059 DRAM: 128 MiB
60 trace: enabled
61 Using default environment
Simon Glassb2e16a82013-06-11 11:14:39 -070062
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010063 In: serial
64 Out: serial
65 Err: serial
66 =>trace stats
67 671,406 function sites
68 69,712 function calls
69 0 untracked function calls
70 73,373 traced function calls
71 16 maximum observed call depth
72 15 call depth limit
73 66,491 calls not traced due to depth
74 =>trace stats
75 671,406 function sites
Simon Glassb2e16a82013-06-11 11:14:39 -070076 1,279,450 function calls
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010077 0 untracked function calls
78 950,490 traced function calls (333217 dropped due to overflow)
79 16 maximum observed call depth
80 15 call depth limit
81 1,275,767 calls not traced due to depth
Simon Glasse46b7242023-01-15 14:16:01 -070082 =>trace calls 1000000 e00000
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010083 Call list dumped to 00000000, size 0xae0a40
84 =>print
85 baudrate=115200
86 profbase=0
87 profoffset=ae0a40
88 profsize=e00000
89 stderr=serial
90 stdin=serial
91 stdout=serial
Simon Glassb2e16a82013-06-11 11:14:39 -070092
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010093 Environment size: 117/8188 bytes
Simon Glasse46b7242023-01-15 14:16:01 -070094 =>host save hostfs - 1000000 trace ${profoffset}
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010095 11405888 bytes written in 10 ms (1.1 GiB/s)
96 =>reset
Simon Glassb2e16a82013-06-11 11:14:39 -070097
98
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +010099Then run proftool to convert the trace information to ftrace format
Simon Glassb2e16a82013-06-11 11:14:39 -0700100
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100101.. code-block:: console
Simon Glassb2e16a82013-06-11 11:14:39 -0700102
Pavel Skripkind53b2cf2023-04-12 22:05:31 +0300103 $ ./sandbox/tools/proftool -m sandbox/System.map -t trace dump-ftrace -o trace.dat
Simon Glassb2e16a82013-06-11 11:14:39 -0700104
Simon Glasse46b7242023-01-15 14:16:01 -0700105Finally run kernelshark to display it (note it only works with `.dat` files!):
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100106
107.. code-block:: console
108
Simon Glasse46b7242023-01-15 14:16:01 -0700109 $ kernelshark trace.dat
Simon Glassb2e16a82013-06-11 11:14:39 -0700110
Simon Glasse46b7242023-01-15 14:16:01 -0700111Using this tool you can view the trace records and see the timestamp for each
Simon Glassb2e16a82013-06-11 11:14:39 -0700112function.
113
Simon Glasse46b7242023-01-15 14:16:01 -0700114.. image:: pics/kernelshark.png
115 :width: 800
116 :alt: Kernelshark showing function-trace records
117
118
119To see the records on the console, use trace-cmd:
120
121.. code-block:: console
122
123 $ trace-cmd report trace.dat | less
124 cpus=1
125 u-boot-1 [000] 3.116364: function: initf_malloc
126 u-boot-1 [000] 3.116375: function: initf_malloc
127 u-boot-1 [000] 3.116386: function: initf_bootstage
128 u-boot-1 [000] 3.116396: function: bootstage_init
129 u-boot-1 [000] 3.116408: function: malloc
130 u-boot-1 [000] 3.116418: function: malloc_simple
131 u-boot-1 [000] 3.116429: function: alloc_simple
132 u-boot-1 [000] 3.116441: function: alloc_simple
133 u-boot-1 [000] 3.116449: function: malloc_simple
134 u-boot-1 [000] 3.116457: function: malloc
135
136Note that `pytimechart` is obsolete so cannot be used anymore.
137
138There is a -f option available to select a function graph:
139
140.. code-block:: console
141
142 $ ./sandbox/tools/proftool -m sandbox/System.map -t trace -f funcgraph dump-ftrace >trace.dat
143
144Again, you can use kernelshark or trace-cmd to look at the output. In this case
145you will see the time taken by each function shown against its exit record.
146
147.. image:: pics/kernelshark_fg.png
148 :width: 800
149 :alt: Kernelshark showing function-graph records
150
151.. code-block:: console
152
153 $ trace-cmd report trace.dat | less
154 cpus=1
155 u-boot-1 [000] 3.116364: funcgraph_entry: 0.011 us | initf_malloc();
156 u-boot-1 [000] 3.116386: funcgraph_entry: | initf_bootstage() {
157 u-boot-1 [000] 3.116396: funcgraph_entry: | bootstage_init() {
158 u-boot-1 [000] 3.116408: funcgraph_entry: | malloc() {
159 u-boot-1 [000] 3.116418: funcgraph_entry: | malloc_simple() {
160 u-boot-1 [000] 3.116429: funcgraph_entry: 0.012 us | alloc_simple();
161 u-boot-1 [000] 3.116449: funcgraph_exit: 0.031 us | }
162 u-boot-1 [000] 3.116457: funcgraph_exit: 0.049 us | }
163 u-boot-1 [000] 3.116466: funcgraph_entry: 0.063 us | memset();
164 u-boot-1 [000] 3.116539: funcgraph_exit: 0.143 us | }
165
166Flame graph
167-----------
168
169Some simple flame graph options are available as well, using the dump-flamegraph
170command:
171
172.. code-block:: console
173
174 $ ./sandbox/tools/proftool -m sandbox/System.map -t trace dump-flamegraph >trace.fg
175 $ flamegraph.pl trace.fg >trace.svg
176
177You can load the .svg file into a viewer. If you use Chrome (and some other
178programs) you can click around and zoom in and out.
179
180.. image:: pics/flamegraph.png
181 :width: 800
182 :alt: Chrome showing the flamegraph.pl output
183
184.. image:: pics/flamegraph_zoom.png
185 :width: 800
186 :alt: Chrome showing zooming into the flamegraph.pl output
187
188
189A timing variant is also available, which gives an idea of how much time is
190spend in each call stack:
191
192.. code-block:: console
193
194 $ ./sandbox/tools/proftool -m sandbox/System.map -t trace dump-flamegraph -f timing >trace.fg
195 $ flamegraph.pl trace.fg >trace.svg
196
197Note that trace collection does slow down execution so the timings will be
198inflated. They should be used to guide optimisation. For accurate boot timings,
199use bootstage.
200
201.. image:: pics/flamegraph_timing.png
202 :width: 800
203 :alt: Chrome showing flamegraph.pl output with timing
Simon Glassb2e16a82013-06-11 11:14:39 -0700204
205CONFIG Options
206--------------
207
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100208CONFIG_TRACE
209 Enables the trace feature in U-Boot.
Simon Glassb2e16a82013-06-11 11:14:39 -0700210
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100211CONFIG_CMD_TRACE
212 Enables the trace command.
Simon Glassb2e16a82013-06-11 11:14:39 -0700213
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100214CONFIG_TRACE_BUFFER_SIZE
215 Size of trace buffer to allocate for U-Boot. This buffer is
216 used after relocation, as a place to put function tracing
217 information. The address of the buffer is determined by
218 the relocation code.
Simon Glassb2e16a82013-06-11 11:14:39 -0700219
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100220CONFIG_TRACE_EARLY
221 Define this to start tracing early, before relocation.
Simon Glassb2e16a82013-06-11 11:14:39 -0700222
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100223CONFIG_TRACE_EARLY_SIZE
224 Size of 'early' trace buffer. Before U-Boot has relocated
225 it doesn't have a proper trace buffer. On many boards
226 you can define an area of memory to use for the trace
227 buffer until the 'real' trace buffer is available after
228 relocation. The contents of this buffer are then copied to
229 the real buffer.
Simon Glassb2e16a82013-06-11 11:14:39 -0700230
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100231CONFIG_TRACE_EARLY_ADDR
232 Address of early trace buffer
Simon Glassb2e16a82013-06-11 11:14:39 -0700233
Simon Glasse46b7242023-01-15 14:16:01 -0700234CONFIG_TRACE_CALL_DEPTH_LIMIT
235 Sets the limit on trace call-depth. For a broad view, 10 is typically
236 sufficient. Setting this too large creates enormous traces and distorts
237 the overall timing considerable.
238
Simon Glassb2e16a82013-06-11 11:14:39 -0700239
240Building U-Boot with Tracing Enabled
241------------------------------------
242
243Pass 'FTRACE=1' to the U-Boot Makefile to actually instrument the code.
244This is kept as a separate option so that it is easy to enable/disable
245instrumenting from the command line instead of having to change board
246config files.
247
248
Simon Glasse46b7242023-01-15 14:16:01 -0700249Board requirements
250------------------
251
252Trace data collection relies on a microsecond timer, accessed through
253`timer_get_us()`. So the first thing you should do is make sure that
254this produces sensible results for your board. Suitable sources for
255this timer include high resolution timers, PWMs or profile timers if
256available. Most modern SOCs have a suitable timer for this.
257
258See `add_ftrace()` for where `timer_get_us()` is called. The `notrace`
259attribute must be used on each function called by `timer_get_us()` since
260recursive calls to `add_ftrace()` will cause a fault::
261
262 trace: recursion detected, disabling
263
264You cannot use driver model to obtain the microsecond timer, since tracing
265may be enabled before driver model is set up. Instead, provide a low-level
266function which accesses the timer, setting it up if needed.
267
268
Simon Glassb2e16a82013-06-11 11:14:39 -0700269Collecting Trace Data
270---------------------
271
272When you run U-Boot on your board it will collect trace data up to the
273limit of the trace buffer size you have specified. Once that is exhausted
274no more data will be collected.
275
Simon Glasse46b7242023-01-15 14:16:01 -0700276Collecting trace data affects execution time and performance. You
Heinrich Schuchardt3f800642021-11-16 18:38:47 +0100277will notice this particularly with trivial functions - the overhead of
Simon Glassb2e16a82013-06-11 11:14:39 -0700278recording their execution may even exceed their normal execution time.
279In practice this doesn't matter much so long as you are aware of the
Heinrich Schuchardt3f800642021-11-16 18:38:47 +0100280effect. Once you have done your optimizations, turn off tracing before
Simon Glasse46b7242023-01-15 14:16:01 -0700281doing end-to-end timing using bootstage.
Simon Glassb2e16a82013-06-11 11:14:39 -0700282
283The best time to start tracing is right at the beginning of U-Boot. The
284best time to stop tracing is right at the end. In practice it is hard
285to achieve these ideals.
286
Simon Glasse46b7242023-01-15 14:16:01 -0700287This implementation enables tracing early in `board_init_r()`, or
288`board_init_f()` when `TRACE_EARLY` is enabled. This means
Simon Glassb2e16a82013-06-11 11:14:39 -0700289that it captures most of the board init process, missing only the
290early architecture-specific init. However, it also misses the entire
Simon Glasse46b7242023-01-15 14:16:01 -0700291SPL stage if there is one. At present tracing is not supported in SPL.
Simon Glassb2e16a82013-06-11 11:14:39 -0700292
293U-Boot typically ends with a 'bootm' command which loads and runs an
294OS. There is useful trace data in the execution of that bootm
295command. Therefore this implementation provides a way to collect trace
296data after bootm has finished processing, but just before it jumps to
297the OS. In practical terms, U-Boot runs the 'fakegocmd' environment
298variable at this point. This variable should have a short script which
299collects the trace data and writes it somewhere.
300
Simon Glasse46b7242023-01-15 14:16:01 -0700301Controlling the trace
302---------------------
Simon Glassb2e16a82013-06-11 11:14:39 -0700303
Simon Glasse46b7242023-01-15 14:16:01 -0700304U-Boot provides a command-line interface to the trace system for controlling
305tracing and accessing the trace data. See :doc:`../usage/cmd/trace`.
Simon Glassb2e16a82013-06-11 11:14:39 -0700306
307
308Environment Variables
309---------------------
310
311The following are used:
312
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100313profbase
314 Base address of trace output buffer
Simon Glassb2e16a82013-06-11 11:14:39 -0700315
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100316profoffset
317 Offset of first unwritten byte in trace output buffer
Simon Glassb2e16a82013-06-11 11:14:39 -0700318
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100319profsize
320 Size of trace output buffer
Simon Glassb2e16a82013-06-11 11:14:39 -0700321
322All of these are set by the 'trace calls' command.
323
324These variables keep track of the amount of data written to the trace
325output buffer by the 'trace' command. The trace commands which write data
326to the output buffer can use these to specify the buffer to write to, and
327update profoffset each time. This allows successive commands to append data
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100328to the same buffer, for example::
Simon Glassb2e16a82013-06-11 11:14:39 -0700329
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100330 => trace funclist 10000 e00000
331 => trace calls
Simon Glassb2e16a82013-06-11 11:14:39 -0700332
333(the latter command appends more data to the buffer).
334
335
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100336fakegocmd
337 Specifies commands to run just before booting the OS. This
338 is a useful time to write the trace data to the host for
339 processing.
Simon Glassb2e16a82013-06-11 11:14:39 -0700340
341
342Writing Out Trace Data
343----------------------
344
345Once the trace data is in an output buffer in memory there are various ways
346to transmit it to the host. Notably you can use tftput to send the data
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100347over a network link::
Simon Glassb2e16a82013-06-11 11:14:39 -0700348
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100349 fakegocmd=trace pause; usb start; set autoload n; bootp;
350 trace calls 10000000 1000000;
351 tftpput ${profbase} ${profoffset} 192.168.1.4:/tftpboot/calls
Simon Glassb2e16a82013-06-11 11:14:39 -0700352
353This starts up USB (to talk to an attached USB Ethernet dongle), writes
354a trace log to address 10000000 and sends it to a host machine using
355TFTP. After this, U-Boot will boot the OS normally, albeit a little
356later.
357
Simon Glasse46b7242023-01-15 14:16:01 -0700358For a filesystem you may do something like::
Simon Glassb2e16a82013-06-11 11:14:39 -0700359
Simon Glasse46b7242023-01-15 14:16:01 -0700360 trace calls 10000000 1000000;
361 save mmc 1:1 10000000 /trace ${profoffset}
362
363The trace buffer format is internal to the trace system. It consists of a
364header, a call count for each function site, followed by a list of trace
365records, once for each function call.
366
367
368Converting Trace Output Data (proftool)
369---------------------------------------
Simon Glassb2e16a82013-06-11 11:14:39 -0700370
371The trace output data is kept in a binary format which is not documented
Simon Glasse46b7242023-01-15 14:16:01 -0700372here. See the `trace.h` header file if you are interested. To convert it into
373something useful, you can use proftool.
Simon Glassb2e16a82013-06-11 11:14:39 -0700374
375This tool must be given the U-Boot map file and the trace data received
Simon Glasse46b7242023-01-15 14:16:01 -0700376from running that U-Boot. It produces a binary output file.
Simon Glassb2e16a82013-06-11 11:14:39 -0700377
Simon Glasse46b7242023-01-15 14:16:01 -0700378It is also possible to provide a configuration file to indicate which functions
379should be included or dropped during conversion. This file consists of lines
380like::
381
382 include-func <regex>
383 exclude-func <regex>
384
385where <regex> is a regular expression matched against function names. It
386allows some functions to be dropped from the trace when producing ftrace
387records.
388
389Options:
390
391-c <config_file>
392 Specify the optional configuration file, to control which functions are
393 included in the output.
394
395-f <format>
396 Specifies the format to use (see below)
Simon Glassb2e16a82013-06-11 11:14:39 -0700397
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100398-m <map_file>
Simon Glasse46b7242023-01-15 14:16:01 -0700399 Specify U-Boot map file (`System.map`)
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100400
Simon Glasse46b7242023-01-15 14:16:01 -0700401-o <output file>
402 Specify the output filename
403
404-t <trace_file>
405 Specify trace file, the data saved from U-Boot
406
407-v <0-4>
408 Specify the verbosity, where 0 is the minimum and 4 is for debugging.
Simon Glassb2e16a82013-06-11 11:14:39 -0700409
410Commands:
411
Simon Glasse46b7242023-01-15 14:16:01 -0700412dump-ftrace:
413 Write a binary dump of the file in Linux ftrace format. Two options are
414 available:
Simon Glassb2e16a82013-06-11 11:14:39 -0700415
Simon Glasse46b7242023-01-15 14:16:01 -0700416 function
417 write function-call records (caller/callee)
418
419 funcgraph
420 write function entry/exit records (graph)
421
422 This format can be used with kernelshark_ and trace_cmd_.
423
424dump-flamegraph
425 Write a list of stack records useful for producing a flame graph. Two
426 options are available:
427
428 calls
429 create a flamegraph of stack frames
430
431 timing
432 create a flamegraph of microseconds for each stack frame
433
434 This format can be used with flamegraph_pl_.
Simon Glassb2e16a82013-06-11 11:14:39 -0700435
436Viewing the Trace Data
437----------------------
438
Simon Glasse46b7242023-01-15 14:16:01 -0700439You can use kernelshark_ for a GUI, but note that version 2.0.x was broken. If
440you have that version you could try building it from source.
Simon Glassb2e16a82013-06-11 11:14:39 -0700441
Simon Glasse46b7242023-01-15 14:16:01 -0700442The file must have a .dat extension or it is ignored. The program has terse
443user interface but is very convenient for viewing U-Boot profile information.
444
445Also available is trace_cmd_ which provides a command-line interface.
Simon Glassb2e16a82013-06-11 11:14:39 -0700446
447Workflow Suggestions
448--------------------
449
450The following suggestions may be helpful if you are trying to reduce boot
451time:
452
4531. Enable CONFIG_BOOTSTAGE and CONFIG_BOOTSTAGE_REPORT. This should get
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100454 you are helpful overall snapshot of the boot time.
Simon Glassb2e16a82013-06-11 11:14:39 -0700455
4562. Build U-Boot with tracing and run it. Note the difference in boot time
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100457 (it is common for tracing to add 10% to the time)
Simon Glassb2e16a82013-06-11 11:14:39 -0700458
Heinrich Schuchardt3f800642021-11-16 18:38:47 +01004593. Collect the trace information as described above. Use this to find where
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100460 all the time is being spent.
Simon Glassb2e16a82013-06-11 11:14:39 -0700461
Heinrich Schuchardt3f800642021-11-16 18:38:47 +01004624. Take a look at that code and see if you can optimize it. Perhaps it is
463 possible to speed up the initialization of a device, or remove an unused
Heinrich Schuchardtdce26c72020-12-12 10:14:22 +0100464 feature.
Simon Glassb2e16a82013-06-11 11:14:39 -0700465
4665. Rebuild, run and collect again. Compare your results.
467
4686. Keep going until you run out of steam, or your boot is fast enough.
469
470
471Configuring Trace
472-----------------
473
474There are a few parameters in the code that you may want to consider.
475There is a function call depth limit (set to 15 by default). When the
476stack depth goes above this then no tracing information is recorded.
477The maximum depth reached is recorded and displayed by the 'trace stats'
Simon Glasse46b7242023-01-15 14:16:01 -0700478command. While it might be tempting to set the depth limit quite high, this
479can dramatically increase the size of the trace output as well as the execution
480time.
Simon Glassb2e16a82013-06-11 11:14:39 -0700481
482
483Future Work
484-----------
485
486Tracing could be a little tidier in some areas, for example providing
487run-time configuration options for trace.
488
489Some other features that might be useful:
490
491- Trace filter to select which functions are recorded
492- Sample-based profiling using a timer interrupt
493- Better control over trace depth
494- Compression of trace information
495
496
Simon Glasse46b7242023-01-15 14:16:01 -0700497.. sectionauthor:: Simon Glass <sjg@chromium.org>
498.. April 2013
499.. Updated January 2023
500
501.. _kernelshark: https://kernelshark.org/
502.. _trace_cmd: https://www.trace-cmd.org/
503.. _flamegraph_pl: https://github.com/brendangregg/FlameGraph/blob/master/flamegraph.pl