1

E.g. in AtomicSimpleCPU where each tick is 500 units, I would like to have something like:

0 function1
2000 function2
5000 function3

which indicates that function1 started executing at time 0, function2 at time 2000 and so on.

I could parse that out of --debug-flags ExecAll, but since that outputs large amounts of information, it significantly slows downs execution which is a annoying.

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44

1 Answers1

1

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.

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
  • hi, i tried using this for SE mode, but it shows multiple main entries and does not show thread function in the trace. – gPats Mar 01 '23 at 18:10