On 07/15/2013 04:36 PM, Ali Saidi wrote:
On 10.07.2013 06:24, Hui Zhao wrote:

Hello
   I am running multithreaded applications on Gem5. I want to stop the
simulation when the sum of all cores' executed instructions reaches
some million. But the current -I n will stop when any core reaches the
n instructions. How can I do this?

Thanks

You'll need to write some code that counts all the instructions that are
executed and generates an exit event when that happens. For example you
could add a variable to the system object and where numInsts is
incremented for each cpu individually correctly and then in the
increment check if you've reached your maximum generate
a SimLoopExitEvent().

It's actually even simpler. There is already some support for triggering events on total instruction counts in vanilla gem5. There is an event queue called instEventQueue in the system object that activates events when a given /total/ number of instructions in that system have been executed. It seems to get called from all CPU models, so it /should/ work, but I don't think we use it anywhere so YMMV.

BaseCPU::scheduleInstStop() shows you how to schedule an exit event in a threads local instruction event queue. Checkout BaseCPU.py for an example of how this is exported to the Python world. I'd suggest that you do something similar for the System class.

//Andreas

_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to