diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-11-20 18:33:17 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-11-20 18:33:17 -0500 |
commit | b62e7d24ec82fd3f27783bc13fb223f64ed0c1c9 (patch) | |
tree | d37d75ce6225419d78849c5c0881612278dace5f /cpu | |
parent | 9e8151f39220957b2be0b546544b6e74831071a9 (diff) | |
download | gem5-b62e7d24ec82fd3f27783bc13fb223f64ed0c1c9.tar.xz |
clear the function profile on a stats reset
cpu/profile.hh:
Add a placeholder for a reset callback
--HG--
extra : convert_revision : 7fa13e5d04daf1cf93eb35c8fdaf67a40ce3ef73
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/profile.cc | 8 | ||||
-rw-r--r-- | cpu/profile.hh | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/cpu/profile.cc b/cpu/profile.cc index f4aa81c2b..1a38792a0 100644 --- a/cpu/profile.cc +++ b/cpu/profile.cc @@ -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 * diff --git a/cpu/profile.hh b/cpu/profile.hh index b7526ab6a..58cd7e79f 100644 --- a/cpu/profile.hh +++ b/cpu/profile.hh @@ -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; |