Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
scripts/ | 12-May-2024 | - | 185 | 133 | ||
CMakeLists.txt | D | 12-May-2024 | 1.3 KiB | 34 | 27 | |
README.md | D | 12-May-2024 | 3.2 KiB | 49 | 35 | |
args_parser.h | D | 12-May-2024 | 2.4 KiB | 82 | 52 | |
aspt_converter.cpp | D | 12-May-2024 | 7.9 KiB | 259 | 199 | |
aspt_converter.h | D | 12-May-2024 | 2.4 KiB | 88 | 45 | |
main.cpp | D | 12-May-2024 | 1.3 KiB | 48 | 24 | |
options.yaml | D | 12-May-2024 | 1.9 KiB | 65 | 43 | |
trace_dumper.cpp | D | 12-May-2024 | 4 KiB | 138 | 94 | |
trace_dumper.h | D | 12-May-2024 | 3.6 KiB | 116 | 76 |
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