diff options
author | Kevin Lim <ktlim@umich.edu> | 2006-08-24 17:43:08 -0400 |
---|---|---|
committer | Kevin Lim <ktlim@umich.edu> | 2006-08-24 17:43:08 -0400 |
commit | ad2fa1e1c9587e8c2a2b7f3e5a9c592312042eb4 (patch) | |
tree | e52b0443cc937e127c5d31b49f0c2dcf280c4d50 /cpu/ozone/thread_state.hh | |
parent | 74e8abd37ecd637a607f90e36aed1a3a16eea7da (diff) | |
download | gem5-ad2fa1e1c9587e8c2a2b7f3e5a9c592312042eb4.tar.xz |
Support profiling.
--HG--
extra : convert_revision : eab02dea68442bd3f8c5d1d16b7f93f43cbda2a5
Diffstat (limited to 'cpu/ozone/thread_state.hh')
-rw-r--r-- | cpu/ozone/thread_state.hh | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/cpu/ozone/thread_state.hh b/cpu/ozone/thread_state.hh index f104dff23..93a56da1b 100644 --- a/cpu/ozone/thread_state.hh +++ b/cpu/ozone/thread_state.hh @@ -31,9 +31,12 @@ #include "arch/faults.hh" #include "arch/isa_traits.hh" +#include "base/callback.hh" +#include "base/output.hh" #include "cpu/exec_context.hh" #include "cpu/thread_state.hh" #include "sim/process.hh" +#include "sim/sim_exit.hh" class Event; //class Process; @@ -62,9 +65,22 @@ struct OzoneThreadState : public ThreadState { #if FULL_SYSTEM OzoneThreadState(FullCPU *_cpu, int _thread_num, FunctionalMemory *_mem) : ThreadState(-1, _thread_num, _mem), - inSyscall(0), trapPending(0) + cpu(_cpu), inSyscall(0), trapPending(0) { memset(®s, 0, sizeof(TheISA::RegFile)); + if (cpu->params->profile) { + profile = new FunctionProfile(cpu->params->system->kernelSymtab); + Callback *cb = + new MakeCallback<OzoneThreadState, + &OzoneThreadState::dumpFuncProfile>(this); + registerExitCallback(cb); + } + + // let's fill with a dummy node for now so we don't get a segfault + // on the first cycle when there's no node available. + static ProfileNode dummyNode; + profileNode = &dummyNode; + profilePC = 3; } #else OzoneThreadState(FullCPU *_cpu, int _thread_num, Process *_process, int _asid) @@ -187,6 +203,14 @@ struct OzoneThreadState : public ThreadState { Counter readFuncExeInst() { return funcExeInst; } void setFuncExeInst(Counter new_val) { funcExeInst = new_val; } + +#if FULL_SYSTEM + void dumpFuncProfile() + { + std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name())); + profile->dump(xcProxy, *os); + } +#endif }; #endif // __CPU_OZONE_THREAD_STATE_HH__ |