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:
Nathan Binkert 2005-11-20 18:33:17 -05:00
parent 9e8151f392
commit b62e7d24ec
2 changed files with 9 additions and 1 deletions

View file

@ -29,6 +29,8 @@
#include <string>
#include "base/bitfield.hh"
#include "base/callback.hh"
#include "base/statistics.hh"
#include "base/trace.hh"
#include "cpu/base.hh"
#include "cpu/exec_context.hh"
@ -80,12 +82,16 @@ ProfileNode::clear()
}
FunctionProfile::FunctionProfile(const SymbolTable *_symtab)
: symtab(_symtab)
: reset(0), symtab(_symtab)
{
reset = new MakeCallback<FunctionProfile, &FunctionProfile::clear>(this);
Stats::registerResetCallback(reset);
}
FunctionProfile::~FunctionProfile()
{
if (reset)
delete reset;
}
ProfileNode *

View file

@ -54,9 +54,11 @@ class ProfileNode
void clear();
};
class Callback;
class FunctionProfile
{
private:
Callback *reset;
const SymbolTable *symtab;
ProfileNode top;
std::map<Addr, Counter> pc_count;