Using wallClockProfiler
This profiler is a wrapper around GDB that samples the main thread by getting backtraces
and presents its statistics based on the wall clock - thus including the time spent waiting for I/O.
Keep in mind that the profiled program is paused while GDB gets a backtrace, so don't use very high sampling rates. Also keep an eye on GDB's CPU usage.
Get the software
In the same parent directory as nim-beacon-chain:
Flame graph support is in a PR that's not expected to be merged any time soon by upstream:
Profile beacon_node
Start a Medalla node and get the beacon_node PID:
Assuming the PID you got is 1234, run the profiler for 5 minutes, at 19 samples per second:
Now you can open "profile_19_300.svg" in a browser and click on individual functions to zoom in.
Using prof (also a wall-clock-based profile)
See this for a way to get file names and line numbers: https://github.com/brendangregg/FlameGraph/issues/205#issuecomment-698008393