summaryrefslogtreecommitdiff
path: root/cpu/simple/cpu.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-10-18 19:07:42 -0400
committerNathan Binkert <binkertn@umich.edu>2005-10-18 19:07:42 -0400
commita81c03737addc8e9a9b00cde0354e6c0ab4561af (patch)
treee7415ec9c2a97cf676d5599a1cec2c1fd775ace2 /cpu/simple/cpu.cc
parent357ee7a845eac0bd903ed31e31eec993d54a698c (diff)
downloadgem5-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/simple/cpu.cc')
-rw-r--r--cpu/simple/cpu.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc
index 1bd5547e7..8f7534e16 100644
--- a/cpu/simple/cpu.cc
+++ b/cpu/simple/cpu.cc
@@ -50,6 +50,7 @@
#include "cpu/simple/cpu.hh"
#include "cpu/smt.hh"
#include "cpu/static_inst.hh"
+#include "kern/kernel_stats.hh"
#include "mem/base_mem.hh"
#include "mem/mem_interface.hh"
#include "sim/builder.hh"
@@ -65,6 +66,7 @@
#include "mem/functional/physical.hh"
#include "sim/system.hh"
#include "targetarch/alpha_memory.hh"
+#include "targetarch/stacktrace.hh"
#include "targetarch/vtophys.hh"
#else // !FULL_SYSTEM
#include "mem/functional/functional.hh"
@@ -753,8 +755,21 @@ SimpleCPU::tick()
fault = curStaticInst->execute(this, traceData);
#if FULL_SYSTEM
- if (xc->fnbin)
- xc->execute(curStaticInst.get());
+ if (xc->fnbin) {
+ assert(xc->kernelStats);
+ system->kernelBinning->execute(xc, inst);
+ }
+
+ if (xc->profile) {
+ bool usermode = (xc->regs.ipr[AlphaISA::IPR_DTB_CM] & 0x18) != 0;
+ xc->profilePC = usermode ? 1 : xc->regs.pc;
+ StackTrace *trace = StackTrace::create(xc, inst);
+ if (trace) {
+ xc->profileNode = xc->profile->consume(trace);
+ trace->dprintf();
+ delete trace;
+ }
+ }
#endif
if (curStaticInst->isMemRef()) {
@@ -806,7 +821,6 @@ SimpleCPU::tick()
tickEvent.schedule(curTick + cycles(1));
}
-
////////////////////////////////////////////////////////////////////////
//
// SimpleCPU Simulation Object
@@ -824,6 +838,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(SimpleCPU)
SimObjectParam<FunctionalMemory *> mem;
SimObjectParam<System *> system;
Param<int> cpu_id;
+ Param<Tick> profile;
#else
SimObjectParam<Process *> workload;
#endif // FULL_SYSTEM
@@ -856,6 +871,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(SimpleCPU)
INIT_PARAM(mem, "memory"),
INIT_PARAM(system, "system object"),
INIT_PARAM(cpu_id, "processor ID"),
+ INIT_PARAM(profile, ""),
#else
INIT_PARAM(workload, "processes to run"),
#endif // FULL_SYSTEM
@@ -894,6 +910,7 @@ CREATE_SIM_OBJECT(SimpleCPU)
params->mem = mem;
params->system = system;
params->cpu_id = cpu_id;
+ params->profile = profile;
#else
params->process = workload;
#endif