Hi Victor,

Alternatively, you can also register an exit callback that will
calculate the stat. Have a look at how we use registerExitCallback().
One simple example is in the BaseTags class
(src/mem/cache/tags/base.{hh,cc}).

Nikos

On 12/02/2020 18:43, Jason Lowe-Power wrote:
Hi Victor,

I have no idea if this will work, but have you tried using a lambda
function with whatever captures (e.g., [this]) that you need?

Cheers,
Jason

On Tue, Feb 11, 2020 at 6:53 PM Victor Kariofillis
<[email protected] <mailto:[email protected]>> wrote:

    Hi,

    I have created a stat of type Value called zeroBytesPercentage. It
    is the percentage of zero bytes of all the lines that are written in
    the LLC. I want it to get a value from a function
    (calcZeroBytesPercentage), so I'm using functor.

    zeroBytesPercentage
             .functor(calcZeroBytesPercentage)
             .flags(total)
             .precision(3)
             ;

    Throughout the program execution I'm populating a vector called
    totalLines, which I've declared as public in BaseCache. This vector
    stores all the cache lines that are written to the LLC during the
    execution of the program.

    My problem is that the function is not static and that it uses
    non-static variables (the totalLines vector). I've tried having the
    function as a member of either BaseCache or BaseCache::CacheStats,
    but either way I'm getting errors about the use of non-static data
    members.

    How can I do this calculation at the end of the execution and be
    able to access variables that are non-static?
    _______________________________________________
    gem5-users mailing list
    [email protected] <mailto:[email protected]>
    http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users


_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to