diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-10-18 19:07:42 -0400 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-10-18 19:07:42 -0400 |
commit | a81c03737addc8e9a9b00cde0354e6c0ab4561af (patch) | |
tree | e7415ec9c2a97cf676d5599a1cec2c1fd775ace2 /cpu/base.cc | |
parent | 357ee7a845eac0bd903ed31e31eec993d54a698c (diff) | |
download | gem5-a81c03737addc8e9a9b00cde0354e6c0ab4561af.tar.xz |
Add new function profiling stuff, wrap the pc_sample stuff into it.
SConscript:
Get rid of the pc_sample stuff and move to the new profiling stuff
base/traceflags.py:
DPRINTF Stack stuff
cpu/base.cc:
cpu/base.hh:
cpu/exec_context.cc:
cpu/exec_context.hh:
cpu/simple/cpu.cc:
Add profiling stuff
kern/kernel_stats.hh:
Use a smart pointer
sim/system.cc:
sim/system.hh:
Create a new symbol table that has all of the symbols for a
particular system
util/stats/categories.py:
change around the categories, add categories for function
profiling stuff
util/stats/profile.py:
No profile parsing and display code to deal with function
profiling stuff, graph, dot, and text outputs.
--HG--
extra : convert_revision : b3de0cdc8bd468e42647966e2640ae009bda9eb8
Diffstat (limited to 'cpu/base.cc')
-rw-r--r-- | cpu/base.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/cpu/base.cc b/cpu/base.cc index 8d97bc330..a6e71c808 100644 --- a/cpu/base.cc +++ b/cpu/base.cc @@ -142,8 +142,19 @@ BaseCPU::BaseCPU(Params *p) e->schedule(p->functionTraceStart); } } +#if FULL_SYSTEM + profileEvent = NULL; + if (params->profile) + profileEvent = new ProfileEvent(this, params->profile); +#endif } +BaseCPU::Params::Params() +{ +#if FULL_SYSTEM + profile = false; +#endif +} void BaseCPU::enableFunctionTrace() @@ -163,6 +174,16 @@ BaseCPU::init() } void +BaseCPU::startup() +{ +#if FULL_SYSTEM + if (!params->deferRegistration && profileEvent) + profileEvent->schedule(curTick); +#endif +} + + +void BaseCPU::regStats() { using namespace Stats; @@ -231,11 +252,32 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU) for (int i = 0; i < NumInterruptLevels; ++i) interrupts[i] = oldCPU->interrupts[i]; intstatus = oldCPU->intstatus; + + for (int i = 0; i < execContexts.size(); ++i) + execContexts[i]->profile->clear(); + + if (profileEvent) + profileEvent->schedule(curTick); #endif } #if FULL_SYSTEM +BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, int _interval) + : Event(&mainEventQueue), cpu(_cpu), interval(_interval) +{ } + +void +BaseCPU::ProfileEvent::process() +{ + for (int i = 0, size = cpu->execContexts.size(); i < size; ++i) { + ExecContext *xc = cpu->execContexts[i]; + xc->profile->sample(xc->profileNode, xc->profilePC); + } + + schedule(curTick + interval); +} + void BaseCPU::post_interrupt(int int_num, int index) { |