Search code examples
gem5

What is the best way to measure time in gem5 simulation environment


I am running a small matrix multiplication program in gem5 simulation environment and want to measure execution time of the program. The program is in Fortran and I use cpu_time before and after the matrix multiplication routine to get the time. But is there any other better way to measure time in the gem5 environment?


Solution

  • The standard way of measuring stats for a given binary using gem5 in Full System mode is through providing an rcS script using the --script parameter:

    ./build/ARM/gem5.fast ... your_options... --script=./script.rcS
    

    Your script should contain m5ops to reset and dump stats as required. An example script.rcS:

    m5 resetstats
    /bin/yourbinary
    m5 dumpstats
    

    Then from the stats.txt you can take execution time (sim_seconds) or whatever stat that you require. If you're using the Syscall Emulation mode you can directly check the stats.txt without the need for an rcS script.