From: Nathan Binkert Date: Sun, 20 Nov 2005 23:33:17 +0000 (-0500) Subject: clear the function profile on a stats reset X-Git-Tag: m5_2.0_beta1~296 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b62e7d24ec82fd3f27783bc13fb223f64ed0c1c9;p=gem5.git clear the function profile on a stats reset cpu/profile.hh: Add a placeholder for a reset callback --HG-- extra : convert_revision : 7fa13e5d04daf1cf93eb35c8fdaf67a40ce3ef73 --- 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 #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(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 pc_count;