From 0dcb288365931b5b6c1048302c23656473fea1af Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 20 Nov 2005 17:44:58 -0500 Subject: Cleanup the StackTrace interfaces and profile interfaces so they are more efficient and reduce the number of new/delete calls arch/alpha/stacktrace.cc: - Change the StackTrace code so that the class can more easily be cleaned out and reused to avoid extra allocations. - Allow trace() to accept a static instruction pointer so it can determine if the instruction is worth tracing. This is moved from the CPU. - provide constants for special meaning PCs (user, console, unknown), instead of magic numbers - switch to using kernelSymtab instead of allSymtab which will be going away - if the stack adjustment doesn't make any sense, exit and push unknown so we don't get into an infinite loop or record garbage. - check to see if we've made too many iterations through the stack and panic to avoid an infinite loop arch/alpha/stacktrace.hh: - Change the StackTrace code so that the class can more easily be cleaned out and reused to avoid extra allocations. - Allow trace() to accept a static instruction pointer so it can determine if the instruction is worth tracing. This is moved from the CPU. - provide constants for special meaning PCs (user, console, unknown), instead of magic numbers cpu/base.cc: only clear the profile if we have one include profile.hh here since base.hh doesn't do it anymore cpu/base.hh: no need to include cpu/profile.hh here cpu/profile.cc: use ProfileNode pointers instead of objects in the ChildList Consume a vector of addresses since that's really all we care about. cpu/profile.hh: Keep pointers to ProfileNodes to reduce the size of these structures keep a StackTrace around so that we may reuse it. provide consume functions that use the new StackTrace trace interface one consume function is inline and tries to fastpath the no trace condition, it calls the outlined consume function if a trace is generated. cpu/simple/cpu.cc: include cpu/profile.hh here since base.hh no longer does use the new FunctionProfile::consume interface (which contains the tracing functions) --HG-- extra : convert_revision : 5a1d9265289a75f67a497b322926be1f8c2d8eb3 --- cpu/simple/cpu.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'cpu/simple') diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc index 8f7534e16..862fe5b2c 100644 --- a/cpu/simple/cpu.cc +++ b/cpu/simple/cpu.cc @@ -46,6 +46,7 @@ #include "cpu/base.hh" #include "cpu/exec_context.hh" #include "cpu/exetrace.hh" +#include "cpu/profile.hh" #include "cpu/sampler/sampler.hh" #include "cpu/simple/cpu.hh" #include "cpu/smt.hh" @@ -763,12 +764,7 @@ SimpleCPU::tick() 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; - } + xc->profileNode = xc->profile->consume(xc, inst); } #endif -- cgit v1.2.3