gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Build error while adding statistics

AS
Arth Shah
Fri, Jan 19, 2024 1:31 AM

Hi everyone,

I'm attempting to add statistics to the Classic cache's mshr_queue.
There was no stats struct already so I tried to follow the steps in
Bootcamp to add one.
I see the following error though. Could you help?

src/mem/cache/mshr_queue.cc:59:48: error: no matching function for call
to
‘gem5::MSHRQueue::MshrStats::MshrStats(gem5::MSHRQueue*)’
stats(this), demandReserve(demand_reserve)

Here are the main set of changes.

mshr_queue.hh

class MSHRQueue : public Queue<MSHR> {

...

struct MshrStats : public statistics::Group
{
    MshrStats(statistics::Group *parent);

    /** Number of times an entry was inserted in MSHR. */
    statistics::Scalar mshrInserts;

} stats;

...

}

mshr_queue.cc

...
MSHRQueue::MSHRQueue(const std::string &_label,
int num_entries, int reserve,
int demand_reserve, std::string cache_name = "")
: Queue<MSHR>(_label, num_entries, reserve, cache_name + ".mshr_queue"),
stats(this), demandReserve(demand_reserve)
{}

...
MSHRQueue::MshrStats::MshrStats(statistics::Group *parent)
: statistics::Group(parent),
ADD_STAT(mshrInserts, statistics::units::Count::get(),
"Number of times an entry was inserted in MSHR")
{}

Hi everyone, I'm attempting to add statistics to the Classic cache's mshr_queue. There was no stats struct already so I tried to follow the steps in Bootcamp to add one. I see the following error though. Could you help? src/mem/cache/mshr_queue.cc:59:48: *error: no matching function for call to* ‘gem5::MSHRQueue::MshrStats::MshrStats(gem5::MSHRQueue*)’ stats(this), demandReserve(demand_reserve) Here are the main set of changes. *mshr_queue.hh* class MSHRQueue : public Queue<MSHR> { ... struct MshrStats : public statistics::Group { MshrStats(statistics::Group *parent); /** Number of times an entry was inserted in MSHR. */ statistics::Scalar mshrInserts; } stats; ... } *mshr_queue.cc* ... MSHRQueue::MSHRQueue(const std::string &_label, int num_entries, int reserve, int demand_reserve, std::string cache_name = "") : Queue<MSHR>(_label, num_entries, reserve, cache_name + ".mshr_queue"), stats(this), demandReserve(demand_reserve) {} ... MSHRQueue::MshrStats::MshrStats(statistics::Group *parent) : statistics::Group(parent), ADD_STAT(mshrInserts, statistics::units::Count::get(), "Number of times an entry was inserted in MSHR") {}
AS
Arth Shah
Fri, Jan 19, 2024 5:47 PM

Please resolve this query.
I dug deeper and realized MSHRQueue is not inherited from SimObject.
So, it wouldn't support using various statistics macros and classes this
easily.
I have now successfully added the stats I'm interested in as part of the
BaseCache class.

On Thu, Jan 18, 2024 at 7:31 PM Arth Shah arth001@gmail.com wrote:

Hi everyone,

I'm attempting to add statistics to the Classic cache's mshr_queue.
There was no stats struct already so I tried to follow the steps in
Bootcamp to add one.
I see the following error though. Could you help?

src/mem/cache/mshr_queue.cc:59:48: error: no matching function for call
to
‘gem5::MSHRQueue::MshrStats::MshrStats(gem5::MSHRQueue*)’
stats(this), demandReserve(demand_reserve)

Here are the main set of changes.

mshr_queue.hh

class MSHRQueue : public Queue<MSHR> {

...

 struct MshrStats : public statistics::Group
 {
     MshrStats(statistics::Group *parent);

     /** Number of times an entry was inserted in MSHR. */
     statistics::Scalar mshrInserts;

 } stats;

...

}

mshr_queue.cc

...
MSHRQueue::MSHRQueue(const std::string &_label,
int num_entries, int reserve,
int demand_reserve, std::string cache_name = "")
: Queue<MSHR>(_label, num_entries, reserve, cache_name + ".mshr_queue"
),
stats(this), demandReserve(demand_reserve)
{}

...
MSHRQueue::MshrStats::MshrStats(statistics::Group *parent)
: statistics::Group(parent),
ADD_STAT(mshrInserts, statistics::units::Count::get(),
"Number of times an entry was inserted in MSHR")
{}

Please resolve this query. I dug deeper and realized MSHRQueue is not inherited from SimObject. So, it wouldn't support using various statistics macros and classes this easily. I have now successfully added the stats I'm interested in as part of the BaseCache class. On Thu, Jan 18, 2024 at 7:31 PM Arth Shah <arth001@gmail.com> wrote: > Hi everyone, > > I'm attempting to add statistics to the Classic cache's mshr_queue. > There was no stats struct already so I tried to follow the steps in > Bootcamp to add one. > I see the following error though. Could you help? > > src/mem/cache/mshr_queue.cc:59:48: *error: no matching function for call > to* ‘gem5::MSHRQueue::MshrStats::MshrStats(gem5::MSHRQueue*)’ > stats(this), demandReserve(demand_reserve) > > > Here are the main set of changes. > > *mshr_queue.hh* > > class MSHRQueue : public Queue<MSHR> { > > ... > > struct MshrStats : public statistics::Group > { > MshrStats(statistics::Group *parent); > > /** Number of times an entry was inserted in MSHR. */ > statistics::Scalar mshrInserts; > > } stats; > ... > > } > > *mshr_queue.cc* > > ... > MSHRQueue::MSHRQueue(const std::string &_label, > int num_entries, int reserve, > int demand_reserve, std::string cache_name = "") > : Queue<MSHR>(_label, num_entries, reserve, cache_name + ".mshr_queue" > ), > stats(this), demandReserve(demand_reserve) > {} > > ... > MSHRQueue::MshrStats::MshrStats(statistics::Group *parent) > : statistics::Group(parent), > ADD_STAT(mshrInserts, statistics::units::Count::get(), > "Number of times an entry was inserted in MSHR") > {} > >