clear the function profile on a stats reset
cpu/profile.hh: Add a placeholder for a reset callback --HG-- extra : convert_revision : 7fa13e5d04daf1cf93eb35c8fdaf67a40ce3ef73
This commit is contained in:
parent
9e8151f392
commit
b62e7d24ec
|
@ -29,6 +29,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/bitfield.hh"
|
#include "base/bitfield.hh"
|
||||||
|
#include "base/callback.hh"
|
||||||
|
#include "base/statistics.hh"
|
||||||
#include "base/trace.hh"
|
#include "base/trace.hh"
|
||||||
#include "cpu/base.hh"
|
#include "cpu/base.hh"
|
||||||
#include "cpu/exec_context.hh"
|
#include "cpu/exec_context.hh"
|
||||||
|
@ -80,12 +82,16 @@ ProfileNode::clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionProfile::FunctionProfile(const SymbolTable *_symtab)
|
FunctionProfile::FunctionProfile(const SymbolTable *_symtab)
|
||||||
: symtab(_symtab)
|
: reset(0), symtab(_symtab)
|
||||||
{
|
{
|
||||||
|
reset = new MakeCallback<FunctionProfile, &FunctionProfile::clear>(this);
|
||||||
|
Stats::registerResetCallback(reset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionProfile::~FunctionProfile()
|
FunctionProfile::~FunctionProfile()
|
||||||
{
|
{
|
||||||
|
if (reset)
|
||||||
|
delete reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileNode *
|
ProfileNode *
|
||||||
|
|
|
@ -54,9 +54,11 @@ class ProfileNode
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Callback;
|
||||||
class FunctionProfile
|
class FunctionProfile
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
Callback *reset;
|
||||||
const SymbolTable *symtab;
|
const SymbolTable *symtab;
|
||||||
ProfileNode top;
|
ProfileNode top;
|
||||||
std::map<Addr, Counter> pc_count;
|
std::map<Addr, Counter> pc_count;
|
||||||
|
|
Loading…
Reference in a new issue