Hello all,

I have been working with gem5 for a while now. I'm trying to generate 
statistics for the TLM example given in the 
util/systemc/systemc_within_gem5/systemc_gem5_tlm example.
Since there were no in-built stats available for the sc_tlm_target.{cc,hh}, I 
tried to create few of my own using the mechanism given in the documentation. 
I'll add my code snippets below.

#include<>
....
struct TargetParams: public SimObjectParams{
};
class Target: public sc_module, public gem5::SimObject
{
  public:
               ..........
    struct StatGroup : public gem5::statistics::Group {
        gem5::statistics::Scalar testingVariable1;
        gem5::statistics::Scalar testingVariable2;
        gem5::statistics::Scalar testingVariable3;
        StatGroup(gem5::statistics::Group *parent);
    }stats;
          ........
  public:
    PARAMS(Target);
    SC_HAS_PROCESS(Target);
    Target(sc_module_name name, const Params &p) :
         sc_module(name),
         SimObject(p),
         tSocket("tSocket"),
         wrapper(tSocket, std::string(name) + ".tlm", InvalidPortID),
         stats(this)
    {
        .........
    }
.............
};
Target::StatGroup::StatGroup(gem5::statistics::Group *parent)
    : gem5::statistics::Group(parent),
    ADD_STAT(testingVariable1, gem5::statistics::units::Count::get(), 
"Variable1 for testing"),
    ADD_STAT(testingVariable2, gem5::statistics::units::Count::get(), 
"Variable2 for testing"),
    ADD_STAT(testingVariable3, gem5::statistics::units::Count::get(), 
"Variable3 for testing")
{
}

My current gem5 version is gem5v23.1. I'm working on WSL. Please feel ask any 
more questions if needed.

Thank you and hoping to listen from you soon.

Best Regards,
Ananth Pai J

Infineon Technologies IN
DES PTS TI EA SME
Phone: +91 7349045724
ananth.p...@infineon.com<mailto:ananth.p...@infineon.com>

_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to