Hi Leon,

This is exactly what gem5's region of interest (ROI) markers are for. You
can use these "special instructions" as either magic instructions (using
unused opcodes in the ISA) or as memory-mapped IO (useful for KVM CPUs).
You can embed these markers in your program by calling the m5ops functions.
See http://www.gem5.org/documentation/general_docs/m5ops/ for the
documentation.

Once your program has been annotated, you can modify the gem5 runscript
file by adding "system.work_begin_exit_count = 1" or
"system.exit_on_work_items = True" (not sure if these are exactly the right
parameters) which will cause the simulation to exit when the ROI begins. At
that point, in your runscript you can programmatically choose what to do
(e.g., drop a checkpoint, reset stats, dump stats, etc.). See the parsec
run script as an example:
https://gem5.googlesource.com/public/gem5-resources/+/refs/heads/stable/src/parsec/configs/run_parsec.py#115

Cheers,
Jason

On Thu, Apr 22, 2021 at 7:33 AM Leon Zhao via gem5-users <
gem5-users@gem5.org> wrote:

> Hi all,
> I've been wondering if there's a way to measure how many ticks a
> particular part of process costs. I usually do this by hedging code blocks
> around with printf's that contain curTick() and then observing the output.
> But other than that, perhaps a better way exists? (ticks only, ie not
> pertaining to milliseconds or any other time unit)
>
> Thanks in advance.
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to