pull from head before pushing linux tree
[gem5.git] / sim / system.hh
index 8348a144e5053d5c5d3435e7ceff261aeb74a4b9..baf82a5b5a858d38dce41288730c7617ce48ab16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2002-2004 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include <string>
 #include <vector>
 
-#include "sim/sim_object.hh"
-#include "cpu/pc_event.hh"
 #include "base/loader/symtab.hh"
-
-#ifdef FS_MEASURE
 #include "base/statistics.hh"
+#include "cpu/pc_event.hh"
+#include "kern/system_events.hh"
+#include "sim/sim_object.hh"
 #include "sim/sw_context.hh"
-#endif
 
 class MemoryController;
 class PhysicalMemory;
+class Platform;
 class RemoteGDB;
 class GDBListener;
 
@@ -50,17 +49,48 @@ class ExecContext;
 
 class System : public SimObject
 {
-#ifdef FS_MEASURE
-  protected:
-    std::map<const std::string, Statistics::MainBin *> fnBins;
+    // lisa's binning stuff
+  private:
+    std::map<const std::string, Stats::MainBin *> fnBins;
     std::map<const Addr, SWContext *> swCtxMap;
-#endif //FS_MEASURE
+
+  protected:
+    std::vector<FnEvent *> fnEvents;
+
+  public:
+    Stats::Scalar<> fnCalls;
+    Stats::MainBin *Kernel;
+    Stats::MainBin *User;
+
+    Stats::MainBin * getBin(const std::string &name);
+    bool findCaller(std::string, std::string) const;
+
+    SWContext *findContext(Addr pcb);
+    bool addContext(Addr pcb, SWContext *ctx) {
+        return (swCtxMap.insert(make_pair(pcb, ctx))).second;
+    }
+    void remContext(Addr pcb) {
+        swCtxMap.erase(pcb);
+        return;
+    }
+    void dumpState(ExecContext *xc) const;
+
+    virtual void serialize(std::ostream &os);
+    virtual void unserialize(Checkpoint *cp, const std::string &section);
+
+
+  private:
+    std::multimap<const std::string, std::string> callerMap;
+    void populateMap(std::string caller, std::string callee);
+//
 
   public:
     const uint64_t init_param;
     MemoryController *memCtrl;
     PhysicalMemory *physmem;
+    Platform *platform;
     bool bin;
+    std::vector<string> binned_fns;
 
     PCEventQueue pcEventQueue;
 
@@ -69,14 +99,10 @@ class System : public SimObject
     virtual int registerExecContext(ExecContext *xc);
     virtual void replaceExecContext(int xcIndex, ExecContext *xc);
 
-#ifdef FS_MEASURE
-    Statistics::Scalar<Counter, Statistics::MainBin> fnCalls;
-    Statistics::MainBin *nonPath;
-#endif //FS_MEASURE
-
   public:
     System(const std::string _name, const uint64_t _init_param,
-           MemoryController *, PhysicalMemory *, const bool);
+           MemoryController *, PhysicalMemory *, const bool,
+           const std::vector<string> &binned_fns);
     ~System();
 
     virtual Addr getKernelStart() const = 0;
@@ -84,22 +110,6 @@ class System : public SimObject
     virtual Addr getKernelEntry() const = 0;
     virtual bool breakpoint() = 0;
 
-#ifdef FS_MEASURE
-    Statistics::MainBin * getBin(const std::string &name);
-    virtual bool findCaller(std::string, std::string) const = 0;
-
-    SWContext *findContext(Addr pcb);
-    bool addContext(Addr pcb, SWContext *ctx) {
-        return (swCtxMap.insert(make_pair(pcb, ctx))).second;
-    }
-    void remContext(Addr pcb) {
-        swCtxMap.erase(pcb);
-        return;
-    }
-
-    virtual void dumpState(ExecContext *xc) const = 0;
-#endif //FS_MEASURE
-
   public:
     ////////////////////////////////////////////
     //