Discussion:
Destructor invocation
(too old to reply)
Shyam Murthy
2018-11-30 18:07:28 UTC
Permalink
Hello everyone,

I am trying to profile some information while running an application on gem5 using classic cache model. I have added a data structure in the BaseCache class file (src/mem/cache/base.cc <http://base.cc/>). I would like to print the contents of the data structure at the end of the simulation. I don’t see any prints from the BaseCache class destructor at the end of the simulation. How are the BaseCache class objects being destroyed?

I tried printing the contents of the data structure within the OutputStream class destructor, I could see the prints, however the data structure was freed by then. When does gem5 free user defined data structures defined within base.cc <http://base.cc/>?

Thanks in advance.

With regards
Shyam Murthy
Computer Science
UW Madison
Jason Lowe-Power
2018-12-01 00:10:02 UTC
Permalink
Hi Shyam,

You can register a callback function that will execute when the simulator
exits. You can call the following function at any time (likely during
construction of your SimObject) to register the callback:
https://gem5.googlesource.com/public/gem5/+/master/src/sim/sim_exit.hh#46.

Here is an example use very similar to your use case:
https://gem5.googlesource.com/public/gem5/+/master/src/cpu/simple_thread.cc#93

Cheers,
Jason
Post by Shyam Murthy
Hello everyone,
I am trying to profile some information while running an application on
gem5 using classic cache model. I have added a data structure in the
BaseCache class file (src/mem/cache/base.cc). I would like to print the
contents of the data structure at the end of the simulation. I don’t see
any prints from the BaseCache class destructor at the end of the
simulation. How are the BaseCache class objects being destroyed?
I tried printing the contents of the data structure within the
OutputStream class destructor, I could see the prints, however the data
structure was freed by then. When does gem5 free user defined data
structures defined within base.cc?
Thanks in advance.
With regards
Shyam Murthy
Computer Science
UW Madison
_______________________________________________
gem5-users mailing list
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Loading...