1# Profiling astcenc 2 3This page contains some developer notes on profiling `astcenc` using command 4line tools on Linux hosts. 5 6## Building for profiling 7 8It is recommended to profile release builds, but you will need debug symbols. 9It is also recommended to disable link-time optimization to get call stacks 10that vaguely resemble the source code, although beware because this means that 11you are not quite profiling the reality of full release builds. 12 13Both of these can be achieved using the following CMake build type: 14 15```shell 16 -DCMAKE_BUILD_TYPE=RelWithDebInfo 17``` 18 19## Running Callgrind tools 20 21We provide a helper script that wraps Callgrind for hotspot profiling, although 22beware that it only currently supports profiling LDR input images and the 23single compression mode. 24 25This script requires the following tools on your `PATH`: 26 27 * valgrind 28 * gprof2dot 29 * dot 30 31Run the helper script from the root of the repository using, e.g.: 32 33```shell 34python3 ./Test/astc_profile_valgrind.py <image.png> --test-quality fastest 35``` 36 37The output will be two files: 38 39- perf_<quality>.png: an annotated call graph. 40- perf_<quality>.txt: the top N functions table. 41 42### Viewing disassembly 43 44Standard syntax x86-64 disassembly can be generated using: 45 46```shell 47objdump -C -M intel --no-show-raw -d -S <binary> > dis.txt 48``` 49 50- - - 51 52_Copyright © 2020-2022, Arm Limited and contributors. All rights reserved._ 53