From b62e7d24ec82fd3f27783bc13fb223f64ed0c1c9 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 20 Nov 2005 18:33:17 -0500 Subject: clear the function profile on a stats reset cpu/profile.hh: Add a placeholder for a reset callback --HG-- extra : convert_revision : 7fa13e5d04daf1cf93eb35c8fdaf67a40ce3ef73 --- cpu/profile.cc | 8 +++++++- cpu/profile.hh | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'cpu') 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; -- cgit v1.2.3