Hi Shervin,

Negar is right in that there is currently no good way of stopping the simulator every N instructions to dump statistics. I needed to do the same thing some time ago and added support for it in my local 'fixes' branch of gem5 [1]. The changeset you want is [2]. I haven't pushed the patch for review yet, but I intend to do so sometime soon.

When you have that changeset applied, you simply do something like the following in your simulation loop:

your_cpu_object.scheduleInstStop(0, no_instructions_into_the_future, "dump statistics")
event = m5.simulate()
if event.getCause() == "dump statistics":
m5.stats.dump()
else:
# Handle other exit events here
pass

There are two gotchas here:
* The exit event scheduled by scheduleInstStop is removed when it is triggered. You have to schedule a new one if you want another exit after it triggers. * If m5.simulate() exits with a different cause than 'dump statistics', you might have to continue simulating. The instruction stop event will still be in the event queue, so you shouldn't reschedule it in that case. That's not handled correctly in the example above.

//Andreas

[1] https://github.com/andysan/gem5/
[2] https://github.com/andysan/gem5/commit/d649b66f944c9465ee80fbdb10a2766a36798e3e

On 05/21/2013 12:29 PM, Negar Miralaei wrote:
Hi Shervin,

you can dump stats in the Simulation.py file by calling "m5.stats.dump()". I'm not sure how you can dump stats for fixed number of instructions (it's easier to do that based on time intervals), but you can create checkpoints at specific instruction numbers with the option "--at-instruction". Then, restore it from the checkpoint to execute for your interval length. However, it should be some easier ways to dump stats based on the number of instructions, maybe someone else knows!

Cheers
Negar

On 19/05/2013 00:43, shervin hajiamini wrote:

Hi all,


I want to dump stats.txt every fixed interval of instructions. There are already some posted messages in the mailing list about using “testsys.cpu[i].max_insts_any_thread = options.maxinsts” in Simulation.py. I have tested those suggestions but they don’t seem to work.


Can anybody please tell me how I should modify Simulation.py so that stats.txt is dumped periodically based on a fixed number of instructions? I want to dump stats just in the ROI of a benchmark.


Thanks,

Shervin



_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users



_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to