summaryrefslogtreecommitdiff
path: root/src/arch/arm/linux/system.hh
diff options
context:
space:
mode:
authorDam Sunwoo <dam.sunwoo@arm.com>2012-11-02 11:32:01 -0500
committerDam Sunwoo <dam.sunwoo@arm.com>2012-11-02 11:32:01 -0500
commit81406018b0688e956452cd3e00c1ab9aeb9af764 (patch)
treea25309e3a443f1c41a33585c3e7d1a55c2213c49 /src/arch/arm/linux/system.hh
parent322daba74c122c4ba8c89b73ca8107be02990e5c (diff)
downloadgem5-81406018b0688e956452cd3e00c1ab9aeb9af764.tar.xz
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).
Diffstat (limited to 'src/arch/arm/linux/system.hh')
-rw-r--r--src/arch/arm/linux/system.hh42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/arch/arm/linux/system.hh b/src/arch/arm/linux/system.hh
index caf018cb9..feed8cfaa 100644
--- a/src/arch/arm/linux/system.hh
+++ b/src/arch/arm/linux/system.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 ARM Limited
+ * Copyright (c) 2010-2012 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -43,15 +43,24 @@
#ifndef __ARCH_ARM_LINUX_SYSTEM_HH__
#define __ARCH_ARM_LINUX_SYSTEM_HH__
+#include <cstdio>
+#include <map>
#include <string>
#include <vector>
#include "arch/arm/system.hh"
+#include "base/output.hh"
#include "kern/linux/events.hh"
#include "params/LinuxArmSystem.hh"
+#include "sim/core.hh"
+
+class DumpStatsPCEvent;
class LinuxArmSystem : public ArmSystem
{
+ protected:
+ DumpStatsPCEvent *dumpStatsPCEvent;
+
public:
/** Boilerplate params code */
typedef LinuxArmSystemParams Params;
@@ -61,6 +70,20 @@ class LinuxArmSystem : public ArmSystem
return dynamic_cast<const Params *>(_params);
}
+ /** When enabled, dump stats/task info on context switches for
+ * Streamline and per-thread cache occupancy studies, etc. */
+ bool enableContextSwitchStatsDump;
+
+ /** This map stores a mapping of OS process IDs to internal Task IDs. The
+ * mapping is done because the stats system doesn't tend to like vectors
+ * that are much greater than 1000 items and the entire process space is
+ * 65K. */
+ std::map<uint32_t, uint32_t> taskMap;
+
+ /** This is a file that is placed in the run directory that prints out
+ * mappings between taskIds and OS process IDs */
+ std::ostream* taskFile;
+
LinuxArmSystem(Params *p);
~LinuxArmSystem();
@@ -68,6 +91,12 @@ class LinuxArmSystem : public ArmSystem
bool adderBootUncacheable(Addr a);
+ void startup();
+
+ /** This function creates a new task Id for the given pid.
+ * @param tc thread context that is currentyl executing */
+ void mapPid(ThreadContext* tc, uint32_t pid);
+
private:
#ifndef NDEBUG
/** Event to halt the simulator if the kernel calls panic() */
@@ -97,5 +126,16 @@ class LinuxArmSystem : public ArmSystem
Addr penReleaseAddr;
};
+class DumpStatsPCEvent : public PCEvent
+{
+ public:
+ DumpStatsPCEvent(PCEventQueue *q, const std::string &desc, Addr addr)
+ : PCEvent(q, desc, addr)
+ {}
+
+ virtual void process(ThreadContext* tc);
+};
+
+
#endif // __ARCH_ARM_LINUX_SYSTEM_HH__