I stumbled upon a function for this on gem5 6bc2111c9674d0c8db22f6a6adcc00e49625aabd:
gem5.opt fs.py --param 'system.cpu[0].function_trace = True'
--param 'system.cpu[0].function_trace_start = 0'
generates a file ftrace.system.cpu
that contains output of format:
0: _start (6500)
6500: on_exit (2500)
9000: __register_exitproc (13500)
22500: _start (2000)
24500: main (4000)
where e.g. _start
started executing at time 0
and it executed for 6500 units.
I tested an arm64 Linux kernel v5.4.3. boot with it and it only slowed down execution by about 30%, which is great
The functionality is currently disabled for syscall emulation however:
BaseSimpleCPU::postExecute()
{
if (FullSystem)
traceFunctions(instAddr);
I tried to remove that quickly, and the output of main
does seem correct, but for some reason the entry function called __end__
seems to get printed every single timestamp before main
, which is annoying. It should likely be easy to fix.