#flame-graph #cycle #ckb #file #consumption #script #statistical

bin+lib ckb-vm-pprof

Statistical CKB script cycles consumption flame graph

5 releases (breaking)

0.115.0-rc2 Mar 21, 2024
0.114.0 Mar 1, 2024
0.113.0 Jan 10, 2024
0.112.1 Nov 22, 2023
0.111.0 Nov 16, 2023

#13 in #consumption

Download history 11/week @ 2024-01-07 12/week @ 2024-02-18 170/week @ 2024-02-25 16/week @ 2024-03-03 6/week @ 2024-03-10 79/week @ 2024-03-17 3/week @ 2024-03-24 34/week @ 2024-03-31 1/week @ 2024-04-07

118 downloads per month
Used in ckb-debugger

MIT license

795KB
544 lines

Contains (ELF exe/lib, 3MB) res/bench_pairing, (ELF exe/lib, 505KB) res/sprintf, (ELF exe/lib, 34KB) res/abc, (ELF exe/lib, 34KB) res/fib, (ELF exe/lib, 34KB) res/outofmemory, (ELF exe/lib, 35KB) res/sbrk

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:

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

Dependencies

~7MB
~146K SLoC