Skip to content

Statistics

Igor Parfenov edited this page May 5, 2026 · 1 revision

This section contains some useful scripts for gathering statistics.

Code coverage

coverage

This can be made only for C code. Currently code coverage is ~90% lines of code.

  1. Add flag --coverage to both compilation and link stages in Makefiles.
  2. Compile and run all tests: make. Optionally, run language server, to also test its coverage.
mkdir -p build/coverage
lcov -t "Report" -c -d build/compiler/ --output-file build/coverage.info
genhtml build/coverage.info --output-directory build/report
  1. Open file build/coverage/index.html in your browser.

Flamegraphs

flamegraph

This can be made only for C code. In this picture calias used 2.35% of CPU time.

  1. Clone this repository.
  2. Prepare script, which will execute what you want to measure. To measure compilation and testing, better repeat it multiple times. The example script:
for i in $(seq 1 10); do
    make clean ;
    make test ;
done
  1. Probably you will need to allow perf events, which depends on your OS distribution.
mkdir -p build/flamegraph
perf record -F 99 -a -g -- ./script.sh
perf script | <FlameGraph>/stackcollapse-perf.pl | <FlameGraph>/flamegraph.pl > build/flamegraph/flamegraph.svg
  1. Open file build/flamegraph/flamegraph.svg in your browser.

Clone this wiki locally