Profile (CPU or Memory)

Posted 2023-08-10 00:18:41 ‐ 2 min read

profile

introduction

There alternative through to profile the memory usage:

  • perf record -e syscalls:sys_enter_mmap/brk -e page-faults && perf script && flamegraph git repo perl tools output the flamegraph.svg
  • bpf tools recommand the linux kernel version is new
  • using tcmalloc&jemalloc and enable profile feature, using jeprof/pprof to show the heap malloc dump
    • tcmalloc must compile application with -ltcmalloc
    • jemalloc maybe not, need test after test, jemalloc can be used without -ljemalloc, but the prof result is inaccurate, so should be compile with -ljemalloc

a) perf record only can record the syscalls:sys_enter_mmap/brk, can’t trace the malloc, and the perf data is huge b) ebpf need newer linux kernel version, dev host can not support c) Using jemalloc to compile with vcom, and jeprof tool to show the sample data, cause vcom various strange crash or hangs. d) tcmalloc profiler too slow

references