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

bin+lib ckb-vm-pprof

Statistical CKB script cycles consumption flame graph

11 releases (breaking)

0.119.0 Oct 25, 2024
0.118.0-rc1 Aug 28, 2024
0.117.0 Jul 30, 2024
0.115.0-rc2 Mar 21, 2024
0.112.1 Nov 22, 2023

#12 in #consumption

Download history 196/week @ 2024-07-29 106/week @ 2024-08-26 97/week @ 2024-09-02 2/week @ 2024-09-09 139/week @ 2024-09-16 11/week @ 2024-09-23 3/week @ 2024-09-30 1/week @ 2024-10-07 14/week @ 2024-10-14 112/week @ 2024-10-21 7/week @ 2024-10-28 32/week @ 2024-11-04

165 downloads per month

MIT license

795KB
527 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

~8.5MB
~160K SLoC