24.10.3.4. gem5 stats internals
This describes the internals of the gem5 m5out/stats.txt file.
GDB call stack to dumpstats
:
Stats::pythonDump () at build/ARM/python/pybind11/stats.cc:58 Stats::StatEvent::process() () GlobalEvent::BarrierEvent::process (this=0x555559fa6a80) at build/ARM/sim/global_event.cc:131 EventQueue::serviceOne (this=this@entry=0x555558c36080) at build/ARM/sim/eventq.cc:228 doSimLoop (eventq=0x555558c36080) at build/ARM/sim/simulate.cc:219 simulate (num_cycles=<optimized out>) at build/ARM/sim/simulate.cc:132
Stats::pythonDump
does:
void pythonDump() { py::module m = py::module::import("m5.stats"); m.attr("dump")(); }
This calls src/python/m5/stats/init.py
in def dump
does the main dumping
That function does notably:
for output in outputList: if output.valid(): output.begin() for stat in stats_list: stat.visit(output) output.end()
begin
and end
are defined in C++ and output the header and tail respectively
void Text::begin() { ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n"); } void Text::end() { ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n"); stream->flush(); }
stats_list
contains the stats, and stat.visit
prints them, outputList
contains by default just the text output. I don’t see any other types of output in gem5, but likely JSON / binary formats could be envisioned.
Tested in gem5 b4879ae5b0b6644e6836b0881e4da05c64a6550d.