stats: Provide a mechanism to get a callback when stats are dumped.
This mechanism is useful for dumping output that is correlated with stats dumping, but isn't tracked by the gem5 statistics.
This commit is contained in:
parent
0b0c5621ee
commit
8294d49bb6
4 changed files with 23 additions and 0 deletions
|
@ -433,6 +433,7 @@ Formula::str() const
|
|||
return root ? root->str() : "";
|
||||
}
|
||||
|
||||
CallbackQueue dumpQueue;
|
||||
CallbackQueue resetQueue;
|
||||
|
||||
void
|
||||
|
@ -458,6 +459,12 @@ enable()
|
|||
_enabled = true;
|
||||
}
|
||||
|
||||
void
|
||||
registerDumpCallback(Callback *cb)
|
||||
{
|
||||
dumpQueue.add(cb);
|
||||
}
|
||||
|
||||
} // namespace Stats
|
||||
|
||||
void
|
||||
|
|
|
@ -3135,6 +3135,12 @@ bool enabled();
|
|||
*/
|
||||
void registerResetCallback(Callback *cb);
|
||||
|
||||
/**
|
||||
* Register a callback that should be called whenever statistics are
|
||||
* about to be dumped
|
||||
*/
|
||||
void registerDumpCallback(Callback *cb);
|
||||
|
||||
std::list<Info *> &statsList();
|
||||
|
||||
} // namespace Stats
|
||||
|
|
|
@ -103,6 +103,8 @@ def dump():
|
|||
return
|
||||
lastDump = curTick
|
||||
|
||||
internal.stats.processDumpQueue()
|
||||
|
||||
prepare()
|
||||
|
||||
for output in outputList:
|
||||
|
|
|
@ -71,6 +71,13 @@ processResetQueue()
|
|||
resetQueue.process();
|
||||
}
|
||||
|
||||
inline void
|
||||
processDumpQueue()
|
||||
{
|
||||
extern CallbackQueue dumpQueue;
|
||||
dumpQueue.process();
|
||||
}
|
||||
|
||||
inline char *
|
||||
PCC(const char *string)
|
||||
{
|
||||
|
@ -146,6 +153,7 @@ void schedStatEvent(bool dump, bool reset,
|
|||
Tick when = curTick(), Tick repeat = 0);
|
||||
|
||||
void processResetQueue();
|
||||
void processDumpQueue();
|
||||
void enable();
|
||||
bool enabled();
|
||||
|
||||
|
|
Loading…
Reference in a new issue