You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can make gem5 dump statistics in the <<hdf5>> format by adding the magic `h5://` prefix to the file name as in:
12172
+
12173
+
....
12174
+
gem5.opt --stats-file h5://stats.h5
12175
+
....
12176
+
12177
+
as explained in:
12178
+
12179
+
....
12180
+
gem5.opt --stats-help
12181
+
....
12182
+
12183
+
TODO what is the advantage? The generated file for `--stats-file h5://stats.h5?desc=False` in LKMC f42c525d7973d70f4c836d2169cc2bd2893b4197 gem5 5af26353b532d7b5988cf0f6f3d0fbc5087dd1df was 946K, so much larger than the text version!
To prevent the stats file from becoming humongous.
12120
12192
12193
+
===== gem5 stats internals
12194
+
12195
+
This describes the internals of the <<gem5-m5out-stats-txt-file>>.
12196
+
12197
+
GDB call stack to `dumpstats`:
12198
+
12199
+
....
12200
+
Stats::pythonDump () at build/ARM/python/pybind11/stats.cc:58
12201
+
Stats::StatEvent::process() ()
12202
+
GlobalEvent::BarrierEvent::process (this=0x555559fa6a80) at build/ARM/sim/global_event.cc:131
12203
+
EventQueue::serviceOne (this=this@entry=0x555558c36080) at build/ARM/sim/eventq.cc:228
12204
+
doSimLoop (eventq=0x555558c36080) at build/ARM/sim/simulate.cc:219
12205
+
simulate (num_cycles=<optimized out>) at build/ARM/sim/simulate.cc:132
12206
+
....
12207
+
12208
+
`Stats::pythonDump` does:
12209
+
12210
+
....
12211
+
void
12212
+
pythonDump()
12213
+
{
12214
+
py::module m = py::module::import("m5.stats");
12215
+
m.attr("dump")();
12216
+
}
12217
+
....
12218
+
12219
+
This calls `src/python/m5/stats/__init__.py` in `def dump` does the main dumping
12220
+
12221
+
That function does notably:
12222
+
12223
+
....
12224
+
for output in outputList:
12225
+
if output.valid():
12226
+
output.begin()
12227
+
for stat in stats_list:
12228
+
stat.visit(output)
12229
+
output.end()
12230
+
....
12231
+
12232
+
`begin` and `end` are defined in C++ and output the header and tail respectively
12233
+
12234
+
....
12235
+
void
12236
+
Text::begin()
12237
+
{
12238
+
ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
12239
+
}
12240
+
12241
+
void
12242
+
Text::end()
12243
+
{
12244
+
ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
12245
+
stream->flush();
12246
+
}
12247
+
....
12248
+
12249
+
`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.
12250
+
12251
+
Tested in gem5 b4879ae5b0b6644e6836b0881e4da05c64a6550d.
12252
+
12121
12253
==== gem5 config.ini
12122
12254
12123
12255
The `m5out/config.ini` file, contains a very good high level description of the system:
@@ -14457,66 +14589,6 @@ TODO: analyze the trace for:
14457
14589
14458
14590
TODO: like <<gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis>> but even more complex!
14459
14591
14460
-
==== gem5 stats internals
14461
-
14462
-
This describes the internals of the <<gem5-m5out-stats-txt-file>>.
14463
-
14464
-
GDB call stack to `dumpstats`:
14465
-
14466
-
....
14467
-
Stats::pythonDump () at build/ARM/python/pybind11/stats.cc:58
14468
-
Stats::StatEvent::process() ()
14469
-
GlobalEvent::BarrierEvent::process (this=0x555559fa6a80) at build/ARM/sim/global_event.cc:131
14470
-
EventQueue::serviceOne (this=this@entry=0x555558c36080) at build/ARM/sim/eventq.cc:228
14471
-
doSimLoop (eventq=0x555558c36080) at build/ARM/sim/simulate.cc:219
14472
-
simulate (num_cycles=<optimized out>) at build/ARM/sim/simulate.cc:132
14473
-
....
14474
-
14475
-
`Stats::pythonDump` does:
14476
-
14477
-
....
14478
-
void
14479
-
pythonDump()
14480
-
{
14481
-
py::module m = py::module::import("m5.stats");
14482
-
m.attr("dump")();
14483
-
}
14484
-
....
14485
-
14486
-
This calls `src/python/m5/stats/__init__.py` in `def dump` does the main dumping
14487
-
14488
-
That function does notably:
14489
-
14490
-
....
14491
-
for output in outputList:
14492
-
if output.valid():
14493
-
output.begin()
14494
-
for stat in stats_list:
14495
-
stat.visit(output)
14496
-
output.end()
14497
-
....
14498
-
14499
-
`begin` and `end` are defined in C++ and output the header and tail respectively
14500
-
14501
-
....
14502
-
void
14503
-
Text::begin()
14504
-
{
14505
-
ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n");
14506
-
}
14507
-
14508
-
void
14509
-
Text::end()
14510
-
{
14511
-
ccprintf(*stream, "\n---------- End Simulation Statistics ----------\n");
14512
-
stream->flush();
14513
-
}
14514
-
....
14515
-
14516
-
`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.
14517
-
14518
-
Tested in gem5 b4879ae5b0b6644e6836b0881e4da05c64a6550d.
14519
-
14520
14592
==== gem5 code generation
14521
14593
14522
14594
gem5 uses a ton of code generation, which makes the project horrendous:
Binary format to store data. TODO vs databases, notably SQLite: https://datascience.stackexchange.com/questions/262/hierarchical-data-format-what-are-the-advantages-compared-to-alternative-format
16547
16619
16548
-
Examples: link:userland/libs/hdf5[]
16620
+
Examples:
16621
+
16622
+
* link:userland/libs/hdf5[]
16623
+
* gem5 can dump statistics as HDF5: <<gem5-hdf5-statistics>>
0 commit comments