[gem5-users] Re: findOrCreate function

2022-02-10 Thread Scott Blankenberg via gem5-users
Hello Jason,

Following the example in the elastic trace code seems to work for me.

Thanks
___
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] Re: findOrCreate function

2022-02-09 Thread Jason Lowe-Power via gem5-users
Hi Scott,

I think the answer is the same as the prior email. You need to register an
exit callback to close the file stream :). See, for instance, the elastic
trace code:
https://gem5.googlesource.com/public/gem5/+/refs/heads/stable/src/cpu/o3/probe/elastic_trace.cc#103

Cheers,
Jason

On Wed, Feb 9, 2022 at 5:19 PM Scott Blankenberg via gem5-users <
gem5-users@gem5.org> wrote:

> Hello all,
>
> Has anyone used the findOrCreate Gem5 function for opening custom file
> streams?
>
> For example in src/cpu/base.cc we see that this function is used in the
> constructor for BaseCPU
>
>   const std::string fname = csprintf("ftrace.%s", name());
>   functionTraceStream = simout.findOrCreate(fname)->stream();
>
>
> Has anyone who has used this function called it to create .gz files?
>
> I am having an issue right now where for some benchmarks I run that the
> final gz file I get out is not compressed correctly. When I attempt to
> decompress the .gz files, I will get errors such as "unexpected end of
> file".
>
> One possibility I can think of is that the file does not close properly.
> However, I am struggling to find out where I should close the file since I
> need to do it at the end of the simulation and there is no clear place in
> BaseCPU code to place code you want to execute at the end of simulation. I
> have tried using the BaseCPU destructor to close my stream files, but the
> code I put into this destructor does not seemed to be invoked.
>
> Anyways, has anyone ran into similar issues?
>
> Thanks,
>
> Scott Blankenberg
> ___
> 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