From 81406018b0688e956452cd3e00c1ab9aeb9af764 Mon Sep 17 00:00:00 2001 From: Dam Sunwoo Date: Fri, 2 Nov 2012 11:32:01 -0500 Subject: ARM: dump stats and process info on context switches This patch enables dumping statistics and Linux process information on context switch boundaries (__switch_to() calls) that are used for Streamline integration (a graphical statistics viewer from ARM). --- src/cpu/base.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/cpu/base.cc') diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 93c9f8629..aaf9c9cbc 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -118,6 +118,7 @@ BaseCPU::BaseCPU(Params *p, bool is_checker) : MemObject(p), instCnt(0), _cpuId(p->cpu_id), _instMasterId(p->system->getMasterId(name() + ".inst")), _dataMasterId(p->system->getMasterId(name() + ".data")), + _taskId(ContextSwitchTaskId::Unknown), _pid(Request::invldPid), interrupts(p->interrupts), profileEvent(NULL), numThreads(p->numThreads), system(p->system) { @@ -359,6 +360,8 @@ BaseCPU::takeOverFrom(BaseCPU *oldCPU) { assert(threadContexts.size() == oldCPU->threadContexts.size()); assert(_cpuId == oldCPU->cpuId()); + _pid = oldCPU->getPid(); + _taskId = oldCPU->taskId(); ThreadID size = threadContexts.size(); for (ThreadID i = 0; i < size; ++i) { @@ -489,6 +492,13 @@ void BaseCPU::serialize(std::ostream &os) { SERIALIZE_SCALAR(instCnt); + + /* Unlike _pid, _taskId is not serialized, as they are dynamically + * assigned unique ids that are only meaningful for the duration of + * a specific run. We will need to serialize the entire taskMap in + * system. */ + SERIALIZE_SCALAR(_pid); + interrupts->serialize(os); } @@ -496,6 +506,7 @@ void BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) { UNSERIALIZE_SCALAR(instCnt); + UNSERIALIZE_SCALAR(_pid); interrupts->unserialize(cp, section); } -- cgit v1.2.3