• Home
Name
Date
Size
#Lines
LOC

..--

scripts/12-May-2024-185133

CMakeLists.txtD12-May-20241.3 KiB3427

README.mdD12-May-20243.2 KiB4935

args_parser.hD12-May-20242.4 KiB8252

aspt_converter.cppD12-May-20247.9 KiB259199

aspt_converter.hD12-May-20242.4 KiB8845

main.cppD12-May-20241.3 KiB4824

options.yamlD12-May-20241.9 KiB6543

trace_dumper.cppD12-May-20244 KiB13894

trace_dumper.hD12-May-20243.6 KiB11676

README.md

1# Sampler usage
2
3## Generate flamegraph
4
5Download `flamegraph`:
6
7```bash
8cd ${BUILD_DIR}
9git clone https://github.com/brendangregg/FlameGraph.git
10```
11
12```bash
13# get abc bin
14${BUILD_DIR}/bin/es2panda ${BUILD_SOURCE}/plugins/ets/tests/runtime/tooling/sampler/SamplerTest.ets ${BUILD_DIR}/sampling_app.abc
15
16# get sample dump
17${BUILD_DIR}/bin/ark --load-runtimes=ets --boot-panda-files=${BUILD_DIR}/plugins/ets/etsstdlib.abc --sampling-profiler-enable --sampling-profiler-interval=200 --sampling-profiler-output-file=${BUILD_DIR}/outfile.aspt ${BUILD_DIR}/sampling_app.abc ETSGLOBAL::main
18
19# convert sample dump to csv
20${BUILD_DIR}/bin/aspt_converter --input=${BUILD_DIR}/outfile.aspt --output=${BUILD_DIR}/traceout.csv
21
22# generate flamegrath svg
23${BUILD_DIR}/FlameGraph/flamegraph.pl ${BUILD_DIR}/traceout.csv > ${BUILD_DIR}/out.svg
24```
25
26If option `--sampling-profiler-collect-stats` passed on ark launch it creates file at the end of vm's life with information about quantity of sent signal to every thread and created samples.
27    Signals can be ignored if threads are suspended to wait for cpu time(major part of ignored signals), or mutator threads are not executing bytecode (not started or finished).
28
29## AsptConverter parameters
30
31|           Parameter             |          Possible values          |                        Description                          |
32| ------------------------------- | -------------------------------   | ----------------------------------------------------------- |
33| --csv-tid-separation            | single-csv-single-tid             | Doesn't distinguish threads, dump samples in single csv     |
34|                                 | single-csv-multi-tid (by default) | Distinguish threads by thread_id in a single csv file       |
35|                                 | multi-csv                         | Distinguish threads by creating csv files for each thread   |
36| --cold-graph-enable             | true/false (by default: false)    | Add information about thread status (running/suspended)     |
37| --substitute-module-dir         | true/false (by default: false)    | Enable substitution of panda files directories, e.g. run converter on host for .aspt got from device |
38| --substitute-source-str         | {dir1}, {dir2}                    | Substring that will be replaced with substitude-destination |
39| --substitute-destination-str    | {dir_target1}, {dir_target2}      | Substring that will be places instead of substitude-source  |
40| --dump-modules                  | true/false (by default: false)    | In this mode converter only dump modules paths to outfile   |
41
42Note: In substitution parameters (source and destination str) number of strings should be equal and i-th string from source changes only to i-th from destination.
43
44## Limitations
45    1. Samples can be lost but not necessarily in case if signal was sent to interpreter thread while it was in the bridge and frame was not constructed yet. (Relevant to profiling with JIT or ArkTS NAPI)
46        1.1 You can track lost samples by adding options to runtime `--log-level=debug --log-components=profiler`
47
48    2. Tests are not running with TSAN enabled because TSAN can affect user signals and rarely it causes incorrect sampler work.
49