ckb-vm-pprof

Crates.iockb-vm-pprof
lib.rsckb-vm-pprof
version0.119.0
sourcesrc
created_at2023-11-16 08:25:22.171136
updated_at2024-10-25 08:54:48.14956
descriptionStatistical CKB script cycles consumption flame graph
homepage
repository
max_upload_size
id1037398
size3,452,744
Mohanson (mohanson)

documentation

README

CKB VM PProf

This project profiling data in the format expected by the flamegraph visualization tool. It is a sub-project of ckb-vm.

Usage

Suppose the program to be tested is:

int fib(int n) {
    if (n == 0 || n == 1) {
        return n;
    } else {
        return fib(n-1) + fib(n-2);
    }
}

int main() {
    if (fib(10) != 55) {
        return 1;
    }
    return 0;
}

We should take the -g option on compiling for saving the debugging information:

$ riscv64-unknown-elf-gcc -g -o res/fib res/fib.c

To convert the textual representation of a flamegraph to a visual one, first install inferno:

$ cargo install inferno

Then, pass the file created by FlameLayer into inferno-flamegraph:

$ cargo run -- --bin res/fib | inferno-flamegraph > res/fib.svg

Open the svg:

img

Know more about ckb-vm-pprof

  • ckb-vm-pprof-converter: This project converts raw data emitted by ckb-vm-pprof to profile.proto format supported by pprof for detailed analysis.

Licences

MIT

Commit count: 0

cargo fmt