[PTLsim-devel] step just before stopping of the simulation

Matt T. Yourst
Tue Oct 9 15:30:31 EDT 2007


On Tuesday 09 October 2007 09:12, Yusuf wrote:
> Hi Matt,
>
> I am trying to collect statistics related to the entire run of a program,
> and I want to monitor the result at the end of the simulation. But when I
> run the ptlsim without -stopinsns tag or give a big number such as 1000000
> to this tag, I couldn't find where simulation is finishing its job. When I
> give a small number to -stopinsns, it is leaving the simulation after the
> machine->run() function call returns, inside the simulate() function that
> is located at ptlsim.cpp. It leaves by printing "****Stopped after xxxx
> cycles ...." and so on.
>
> Just to be more clear, let me give an example:
> I am giving, say "ls", command to the simulator and I want it to produce me
> a result related to the entire run of ls command and give me the result
> when it finishes running ls.  When I run the simulator with the -stopinsns
> xxxxx configuration, it gives me the result I want, which I print  inside
> the switch_to_sim function after return of the simulate() function call.
>
> But if I give the xxxxxx instruction number big, say 1000000 or run the
> simulator without -stopinsns configuration, it is not coming to the point I
> want.
> As well as I understand, function call chain is like that:  switch_to_sim()
> -> simulate() -> run() -> .....
> Simulator is not getting out of the run() function -that is called by
> simulate function, inside ptlsim.cpp - when I call it without -stopinsns
> feature or with xxxxx a big number.
>
> Perhaps there is being a system call to exit, like exit(0), deep inside
> this function, or something like that. What is the exact reason and how can
> I reach my goal?
>

Why don't you just let it run to completion? As stated in the manual, 
the -stopinsns option is optional - it will automatically exit the simulation 
when the exit() syscall is reached. You'll see information in the logfile 
about every syscall it makes, along with the cycle count and instruction 
count where it happens.

You can also use the "-stats ptlsim.stats" option and ptlstats to print out 
and process more detailed statistics.

- Matt

-------------------------------------------------------
 Matt T. Yourst                    yourst at peptidal.com
 Peptidal Research Inc., Co-Founder and Lead Architect
-------------------------------------------------------


More information about the PTLsim-devel mailing list