Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/25148 )

Change subject: alpha: Move the guts of Kernel::Statistics into FsWorkload.
......................................................................

alpha: Move the guts of Kernel::Statistics into FsWorkload.

Change-Id: I4707d973402148401510697c95e2fea003a7a9e2
---
M src/arch/alpha/SConscript
M src/arch/alpha/ev5.cc
M src/arch/alpha/fs_workload.cc
M src/arch/alpha/fs_workload.hh
M src/arch/alpha/idle_event.cc
M src/arch/alpha/isa/decoder.isa
M src/arch/alpha/isa/main.isa
D src/arch/alpha/kernel_stats.cc
M src/arch/alpha/kernel_stats.hh
9 files changed, 287 insertions(+), 353 deletions(-)



diff --git a/src/arch/alpha/SConscript b/src/arch/alpha/SConscript
index 235ae0f..e28fa56 100644
--- a/src/arch/alpha/SConscript
+++ b/src/arch/alpha/SConscript
@@ -41,7 +41,6 @@
     Source('interrupts.cc')
     Source('ipr.cc')
     Source('isa.cc')
-    Source('kernel_stats.cc')
     Source('linux/linux.cc')
     Source('linux/process.cc')
     Source('linux/fs_workload.cc')
diff --git a/src/arch/alpha/ev5.cc b/src/arch/alpha/ev5.cc
index 3613d30..e1e46e4 100644
--- a/src/arch/alpha/ev5.cc
+++ b/src/arch/alpha/ev5.cc
@@ -30,8 +30,8 @@
  */

 #include "arch/alpha/faults.hh"
+#include "arch/alpha/fs_workload.hh"
 #include "arch/alpha/isa_traits.hh"
-#include "arch/alpha/kernel_stats.hh"
 #include "arch/alpha/osfpal.hh"
 #include "arch/alpha/tlb.hh"
 #include "base/cp_annotate.hh"
@@ -189,9 +189,9 @@
 void
 ISA::setIpr(int idx, uint64_t val, ThreadContext *tc)
 {
-    auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
-            tc->getKernelStats());
-    assert(stats || !tc->getKernelStats());
+    auto *workload = dynamic_cast<AlphaISA::FsWorkload *>(
+            tc->getSystemPtr()->workload);
+    assert(workload || !tc->getSystemPtr()->workload);
     switch (idx) {
       case IPR_PALtemp0:
       case IPR_PALtemp1:
@@ -240,8 +240,8 @@

       case IPR_PALtemp23:
         // write entire quad w/ no side-effect
-        if (stats)
-            stats->context(ipr[idx], val, tc);
+        if (workload)
+            workload->recordContext(ipr[idx], val, tc);
         ipr[idx] = val;
         break;

@@ -264,17 +264,17 @@
       case IPR_IPLR:
         // only write least significant five bits - interrupt level
         ipr[idx] = val & 0x1f;
-        if (stats)
-            stats->swpipl(ipr[idx]);
+        if (workload)
+            workload->recordSwpipl(ipr[idx]);
         break;

       case IPR_DTB_CM:
         if (val & 0x18) {
-            if (stats)
-                stats->mode(Kernel::user, tc);
+            if (workload)
+                workload->recordMode(AlphaISA::FsWorkload::UserMode, tc);
         } else {
-            if (stats)
-                stats->mode(Kernel::kernel, tc);
+            if (workload)
+                workload->recordMode(AlphaISA::FsWorkload::KernelMode, tc);
         }
         M5_FALLTHROUGH;

diff --git a/src/arch/alpha/fs_workload.cc b/src/arch/alpha/fs_workload.cc
index 013245b..d3e4585 100644
--- a/src/arch/alpha/fs_workload.cc
+++ b/src/arch/alpha/fs_workload.cc
@@ -35,10 +35,14 @@

 #include "arch/alpha/ev5.hh"
 #include "arch/alpha/faults.hh"
+#include "arch/alpha/osfpal.hh"
+#include "arch/generic/linux/threadinfo.hh"
 #include "arch/vtophys.hh"
 #include "base/loader/object_file.hh"
 #include "base/loader/symtab.hh"
+#include "base/statistics.hh"
 #include "base/trace.hh"
+#include "debug/Context.hh"
 #include "debug/Loader.hh"
 #include "mem/fs_translating_port_proxy.hh"
 #include "params/AlphaFsWorkload.hh"
@@ -48,7 +52,11 @@
 namespace AlphaISA
 {

-FsWorkload::FsWorkload(Params *p) : KernelWorkload(*p)
+const char *FsWorkload::modeStr[] = { "kernel", "user", "idle" };
+
+FsWorkload::FsWorkload(Params *p) : KernelWorkload(*p),
+    idleProcess((Addr)-1), theMode(KernelMode), lastModeTick(0),
+    iplLast(0), iplLastTick(0)
 {
     // Load Console Code
     console = Loader::createObjectFile(params()->console);
@@ -130,6 +138,181 @@
 }

 void
+FsWorkload::regStats()
+{
+    KernelWorkload::regStats();
+
+    using namespace Stats;
+
+    _callpal
+        .init(256)
+        .name(name() + ".callpal")
+        .desc("number of callpals executed")
+        .flags(total | pdf | nozero | nonan)
+        ;
+
+    for (int i = 0; i < PAL::NumCodes; ++i) {
+        const char *str = PAL::name(i);
+        if (str)
+            _callpal.subname(i, str);
+    }
+
+    _hwrei
+        .name(name() + ".inst.hwrei")
+        .desc("number of hwrei instructions executed")
+        ;
+
+    _mode
+        .init(NumModes)
+        .name(name() + ".mode_switch")
+        .desc("number of protection mode switches")
+        ;
+
+    for (int i = 0; i < NumModes; ++i)
+        _mode.subname(i, modeStr[i]);
+
+    _modeGood
+        .init(NumModes)
+        .name(name() + ".mode_good")
+        ;
+
+    for (int i = 0; i < NumModes; ++i)
+        _modeGood.subname(i, modeStr[i]);
+
+    _modeFraction
+        .name(name() + ".mode_switch_good")
+        .desc("fraction of useful protection mode switches")
+        .flags(total)
+        ;
+
+    for (int i = 0; i < NumModes; ++i)
+        _modeFraction.subname(i, modeStr[i]);
+
+    _modeFraction = _modeGood / _mode;
+
+    _modeTicks
+        .init(NumModes)
+        .name(name() + ".mode_ticks")
+        .desc("number of ticks spent at the given mode")
+        .flags(pdf)
+        ;
+    for (int i = 0; i < NumModes; ++i)
+        _modeTicks.subname(i, modeStr[i]);
+
+    _swapContext
+        .name(name() + ".swap_context")
+        .desc("number of times the context was actually changed")
+        ;
+
+    _iplCount
+        .init(32)
+        .name(name() + ".ipl_count")
+        .desc("number of times we switched to this ipl")
+        .flags(total | pdf | nozero | nonan)
+        ;
+
+    _iplGood
+        .init(32)
+        .name(name() + ".ipl_good")
+ .desc("number of times we switched to this ipl from a different ipl")
+        .flags(total | pdf | nozero | nonan)
+        ;
+
+    _iplTicks
+        .init(32)
+        .name(name() + ".ipl_ticks")
+        .desc("number of cycles we spent at this ipl")
+        .flags(total | pdf | nozero | nonan)
+        ;
+
+    _iplUsed
+        .name(name() + ".ipl_used")
+        .desc("fraction of swpipl calls that actually changed the ipl")
+        .flags(total | nozero | nonan)
+        ;
+
+    _iplUsed = _iplGood / _iplCount;
+}
+
+void
+FsWorkload::setIdleProcess(Addr idle_pcbb, ThreadContext *tc)
+{
+    assert(theMode != UserMode);
+
+    idleProcess = idle_pcbb;
+    theMode = IdleMode;
+    changeMode(theMode, tc);
+}
+
+void
+FsWorkload::changeMode(CpuMode new_mode, ThreadContext *tc)
+{
+    _mode[new_mode]++;
+
+    if (new_mode == theMode)
+        return;
+
+    DPRINTF(Context, "olde mode = %s new mode = %s pid = %d\n",
+            modeStr[theMode], modeStr[new_mode],
+            Linux::ThreadInfo(tc).curTaskPID());
+
+    _modeGood[new_mode]++;
+    _modeTicks[theMode] += curTick() - lastModeTick;
+
+    lastModeTick = curTick();
+    theMode = new_mode;
+}
+
+void
+FsWorkload::recordMode(CpuMode new_mode, ThreadContext *tc)
+{
+    Addr pcbb = tc->readMiscRegNoEffect(IPR_PALtemp23);
+
+    if (new_mode == KernelMode && pcbb == idleProcess)
+        new_mode = IdleMode;
+
+    changeMode(new_mode, tc);
+}
+
+void
+FsWorkload::recordContext(Addr old_pcbb, Addr new_pcbb, ThreadContext *tc)
+{
+    assert(theMode != UserMode);
+
+    _swapContext++;
+    changeMode(new_pcbb == idleProcess ? IdleMode : KernelMode, tc);
+
+    DPRINTF(Context, "Context Switch old pid = %d new pid = %d\n",
+            Linux::ThreadInfo(tc, old_pcbb).curTaskPID(),
+            Linux::ThreadInfo(tc, new_pcbb).curTaskPID());
+}
+
+void
+FsWorkload::recordCallpal(int code, ThreadContext *tc)
+{
+    if (!PAL::name(code))
+        return;
+
+    _callpal[code]++;
+}
+
+void
+FsWorkload::recordSwpipl(int ipl)
+{
+    panic_if(ipl < 0 || ipl > 0x1f, "Invalid IPL.");
+
+    _iplCount[ipl]++;
+
+    if (ipl == iplLast)
+        return;
+
+    _iplGood[ipl]++;
+    _iplTicks[iplLast] += curTick() - iplLastTick;
+    iplLastTick = curTick();
+    iplLast = ipl;
+}
+
+void
 FsWorkload::setAlphaAccess(Addr access)
 {
     FSTranslatingPortProxy
@@ -195,6 +378,31 @@
     }
 }

+void
+FsWorkload::serialize(CheckpointOut &cp) const
+{
+    KernelWorkload::serialize(cp);
+    int exemode = theMode;
+    SERIALIZE_SCALAR(exemode);
+    SERIALIZE_SCALAR(idleProcess);
+    SERIALIZE_SCALAR(lastModeTick);
+    SERIALIZE_SCALAR(iplLast);
+    SERIALIZE_SCALAR(iplLastTick);
+}
+
+void
+FsWorkload::unserialize(CheckpointIn &cp)
+{
+    KernelWorkload::unserialize(cp);
+    int exemode;
+    UNSERIALIZE_SCALAR(exemode);
+    UNSERIALIZE_SCALAR(idleProcess);
+    UNSERIALIZE_SCALAR(lastModeTick);
+    theMode = (CpuMode)exemode;
+    UNSERIALIZE_SCALAR(iplLast);
+    UNSERIALIZE_SCALAR(iplLastTick);
+}
+
 } // namespace AlphaISA

 AlphaISA::FsWorkload *
diff --git a/src/arch/alpha/fs_workload.hh b/src/arch/alpha/fs_workload.hh
index f411d34..c9a90d2 100644
--- a/src/arch/alpha/fs_workload.hh
+++ b/src/arch/alpha/fs_workload.hh
@@ -46,6 +46,37 @@
     FsWorkload(Params *p);
     ~FsWorkload();

+    enum CpuMode { KernelMode, UserMode, IdleMode, NumModes };
+
+  protected:
+    static const char *modeStr[];
+
+    Addr idleProcess;
+    CpuMode theMode;
+    Tick lastModeTick;
+
+    Stats::Vector _callpal;
+
+    Stats::Scalar _hwrei;
+
+    Stats::Vector _mode;
+    Stats::Vector _modeGood;
+    Stats::Formula _modeFraction;
+    Stats::Vector _modeTicks;
+
+    Stats::Scalar _swapContext;
+
+    Stats::Vector _iplCount;
+    Stats::Vector _iplGood;
+    Stats::Vector _iplTicks;
+    Stats::Formula _iplUsed;
+
+    void changeMode(CpuMode newmode, ThreadContext *tc);
+
+  private:
+    int iplLast;
+    Tick iplLastTick;
+
   public:
     /**
      * Initialise the state of the system.
@@ -57,6 +88,16 @@
      */
     void startup() override;

+    void regStats() override;
+
+    void recordMode(CpuMode newmode, ThreadContext *tc);
+    void recordContext(Addr oldpcbb, Addr newpcbb, ThreadContext *tc);
+    void recordCallpal(int code, ThreadContext *tc);
+    void recordHwrei() { _hwrei++; }
+    void recordSwpipl(int ipl);
+
+    void setIdleProcess(Addr idle, ThreadContext *tc);
+
     /**
      * Set the m5AlphaAccess pointer in the console
      */
@@ -97,6 +138,9 @@
   public:
     Addr fixFuncEventAddr(Addr addr) const override;
     void setIntrFreq(Tick freq) { intrFreq = freq; }
+
+    void serialize(CheckpointOut &cp) const;
+    void unserialize(CheckpointIn &cp);
 };

 } // namespace AlphaISA
diff --git a/src/arch/alpha/idle_event.cc b/src/arch/alpha/idle_event.cc
index df8a0c6..3de8a93 100644
--- a/src/arch/alpha/idle_event.cc
+++ b/src/arch/alpha/idle_event.cc
@@ -31,20 +31,19 @@

 #include "arch/alpha/idle_event.hh"

-#include "arch/alpha/kernel_stats.hh"
+#include "arch/alpha/fs_workload.hh"
 #include "cpu/thread_context.hh"
-
-using namespace AlphaISA;
+#include "sim/system.hh"

 void
 IdleStartEvent::process(ThreadContext *tc)
 {
-    if (tc->getKernelStats()) {
-        RegVal val = tc->readMiscRegNoEffect(IPR_PALtemp23);
-        auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
-                tc->getKernelStats());
-        assert(stats);
-        stats->setIdleProcess(val, tc);
+    auto *workload = dynamic_cast<AlphaISA::FsWorkload *>(
+            tc->getSystemPtr()->workload);
+
+    if (workload) {
+        RegVal val = tc->readMiscRegNoEffect(AlphaISA::IPR_PALtemp23);
+        workload->setIdleProcess(val, tc);
     }
     remove();
 }
diff --git a/src/arch/alpha/isa/decoder.isa b/src/arch/alpha/isa/decoder.isa
index abf6fb2..d3e826e 100644
--- a/src/arch/alpha/isa/decoder.isa
+++ b/src/arch/alpha/isa/decoder.isa
@@ -860,12 +860,12 @@
                 // on this PAL call (including maybe suppress it)
                 bool dopal = true;
                 ThreadContext *tc = xc->tcBase();
-                auto *base_stats = tc->getKernelStats();
-                auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
-                        base_stats);
-                assert(stats || !base_stats);
-                if (stats)
-                    stats->callpal(palFunc, tc);
+                auto *base_workload = tc->getSystemPtr()->workload;
+                auto *workload = dynamic_cast<AlphaISA::FsWorkload *>(
+                        base_workload);
+                assert(workload || !base_workload);
+                if (workload)
+                    workload->recordCallpal(palFunc, tc);

                 System *sys = tc->getSystemPtr();

@@ -962,12 +962,12 @@
                 NPC = IprExcAddr;

                 ThreadContext *tc = xc->tcBase();
-                auto *base_stats = tc->getKernelStats();
-                auto *stats = dynamic_cast<AlphaISA::Kernel::Statistics *>(
-                        base_stats);
-                assert(stats || !base_stats);
-                if (stats)
-                    stats->hwrei();
+                auto *base_workload = tc->getSystemPtr()->workload;
+                auto *workload = dynamic_cast<AlphaISA::FsWorkload *>(
+                        base_workload);
+                assert(workload || !base_workload);
+                if (workload)
+                    workload->recordHwrei();

                 CPA::cpa()->swAutoBegin(tc, IprExcAddr);
           }}, IsSerializing, IsSerializeBefore);
diff --git a/src/arch/alpha/isa/main.isa b/src/arch/alpha/isa/main.isa
index 15be0d9..d12f302 100644
--- a/src/arch/alpha/isa/main.isa
+++ b/src/arch/alpha/isa/main.isa
@@ -76,7 +76,7 @@
 #include <cmath>

 #include "arch/alpha/decoder.hh"
-#include "arch/alpha/kernel_stats.hh"
+#include "arch/alpha/fs_workload.hh"
 #include "arch/alpha/osfpal.hh"
 #include "arch/alpha/registers.hh"
 #include "arch/alpha/regredir.hh"
diff --git a/src/arch/alpha/kernel_stats.cc b/src/arch/alpha/kernel_stats.cc
deleted file mode 100644
index 39f460f..0000000
--- a/src/arch/alpha/kernel_stats.cc
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2004-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Lisa Hsu
- *          Nathan Binkert
- */
-
-#include "arch/alpha/kernel_stats.hh"
-
-#include <map>
-#include <stack>
-#include <string>
-
-#include "arch/alpha/osfpal.hh"
-#include "arch/generic/linux/threadinfo.hh"
-#include "base/trace.hh"
-#include "cpu/thread_context.hh"
-#include "debug/Context.hh"
-#include "sim/system.hh"
-
-using namespace std;
-using namespace Stats;
-
-namespace AlphaISA {
-namespace Kernel {
-
-const char *modestr[] = { "kernel", "user", "idle" };
-
-Statistics::Statistics()
-    : ::Kernel::Statistics(),
-      idleProcess((Addr)-1), themode(kernel), lastModeTick(0),
-      iplLast(0), iplLastTick(0)
-{
-}
-
-void
-Statistics::regStats(const string &_name)
-{
-    ::Kernel::Statistics::regStats(_name);
-
-    _callpal
-        .init(256)
-        .name(name() + ".callpal")
-        .desc("number of callpals executed")
-        .flags(total | pdf | nozero | nonan)
-        ;
-
-    for (int i = 0; i < PAL::NumCodes; ++i) {
-        const char *str = PAL::name(i);
-        if (str)
-            _callpal.subname(i, str);
-    }
-
-    _hwrei
-        .name(name() + ".inst.hwrei")
-        .desc("number of hwrei instructions executed")
-        ;
-
-    _mode
-        .init(cpu_mode_num)
-        .name(name() + ".mode_switch")
-        .desc("number of protection mode switches")
-        ;
-
-    for (int i = 0; i < cpu_mode_num; ++i)
-        _mode.subname(i, modestr[i]);
-
-    _modeGood
-        .init(cpu_mode_num)
-        .name(name() + ".mode_good")
-        ;
-
-    for (int i = 0; i < cpu_mode_num; ++i)
-        _modeGood.subname(i, modestr[i]);
-
-    _modeFraction
-        .name(name() + ".mode_switch_good")
-        .desc("fraction of useful protection mode switches")
-        .flags(total)
-        ;
-
-    for (int i = 0; i < cpu_mode_num; ++i)
-        _modeFraction.subname(i, modestr[i]);
-
-    _modeFraction = _modeGood / _mode;
-
-    _modeTicks
-        .init(cpu_mode_num)
-        .name(name() + ".mode_ticks")
-        .desc("number of ticks spent at the given mode")
-        .flags(pdf)
-        ;
-    for (int i = 0; i < cpu_mode_num; ++i)
-        _modeTicks.subname(i, modestr[i]);
-
-    _swap_context
-        .name(name() + ".swap_context")
-        .desc("number of times the context was actually changed")
-        ;
-
-    _iplCount
-        .init(32)
-        .name(name() + ".ipl_count")
-        .desc("number of times we switched to this ipl")
-        .flags(total | pdf | nozero | nonan)
-        ;
-
-    _iplGood
-        .init(32)
-        .name(name() + ".ipl_good")
- .desc("number of times we switched to this ipl from a different ipl")
-        .flags(total | pdf | nozero | nonan)
-        ;
-
-    _iplTicks
-        .init(32)
-        .name(name() + ".ipl_ticks")
-        .desc("number of cycles we spent at this ipl")
-        .flags(total | pdf | nozero | nonan)
-        ;
-
-    _iplUsed
-        .name(name() + ".ipl_used")
-        .desc("fraction of swpipl calls that actually changed the ipl")
-        .flags(total | nozero | nonan)
-        ;
-
-    _iplUsed = _iplGood / _iplCount;
-}
-
-void
-Statistics::setIdleProcess(Addr idlepcbb, ThreadContext *tc)
-{
-    assert(themode == kernel);
-    idleProcess = idlepcbb;
-    themode = idle;
-    changeMode(themode, tc);
-}
-
-void
-Statistics::changeMode(cpu_mode newmode, ThreadContext *tc)
-{
-    _mode[newmode]++;
-
-    if (newmode == themode)
-        return;
-
-    DPRINTF(Context, "old mode=%s new mode=%s pid=%d\n",
-            modestr[themode], modestr[newmode],
-            Linux::ThreadInfo(tc).curTaskPID());
-
-    _modeGood[newmode]++;
-    _modeTicks[themode] += curTick() - lastModeTick;
-
-    lastModeTick = curTick();
-    themode = newmode;
-}
-
-void
-Statistics::mode(cpu_mode newmode, ThreadContext *tc)
-{
-    Addr pcbb = tc->readMiscRegNoEffect(IPR_PALtemp23);
-
-    if (newmode == kernel && pcbb == idleProcess)
-        newmode = idle;
-
-    changeMode(newmode, tc);
-}
-
-void
-Statistics::context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc)
-{
-    assert(themode != user);
-
-    _swap_context++;
-    changeMode(newpcbb == idleProcess ? idle : kernel, tc);
-
-    DPRINTF(Context, "Context Switch old pid=%d new pid=%d\n",
-            Linux::ThreadInfo(tc, oldpcbb).curTaskPID(),
-            Linux::ThreadInfo(tc, newpcbb).curTaskPID());
-}
-
-void
-Statistics::callpal(int code, ThreadContext *tc)
-{
-    if (!PAL::name(code))
-        return;
-
-    _callpal[code]++;
-}
-
-void
-Statistics::swpipl(int ipl)
-{
-    assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n");
-
-    _iplCount[ipl]++;
-
-    if (ipl == iplLast)
-        return;
-
-    _iplGood[ipl]++;
-    _iplTicks[iplLast] += curTick() - iplLastTick;
-    iplLastTick = curTick();
-    iplLast = ipl;
-}
-
-void
-Statistics::serialize(CheckpointOut &cp) const
-{
-    ::Kernel::Statistics::serialize(cp);
-    int exemode = themode;
-    SERIALIZE_SCALAR(exemode);
-    SERIALIZE_SCALAR(idleProcess);
-    SERIALIZE_SCALAR(lastModeTick);
-    SERIALIZE_SCALAR(iplLast);
-    SERIALIZE_SCALAR(iplLastTick);
-}
-
-void
-Statistics::unserialize(CheckpointIn &cp)
-{
-    ::Kernel::Statistics::unserialize(cp);
-    int exemode;
-    UNSERIALIZE_SCALAR(exemode);
-    UNSERIALIZE_SCALAR(idleProcess);
-    UNSERIALIZE_SCALAR(lastModeTick);
-    themode = (cpu_mode)exemode;
-    UNSERIALIZE_SCALAR(iplLast);
-    UNSERIALIZE_SCALAR(iplLastTick);
-}
-
-} // namespace Kernel
-} // namespace AlphaISA
diff --git a/src/arch/alpha/kernel_stats.hh b/src/arch/alpha/kernel_stats.hh
index 1bedeb0..4a0618e 100644
--- a/src/arch/alpha/kernel_stats.hh
+++ b/src/arch/alpha/kernel_stats.hh
@@ -32,70 +32,12 @@
 #ifndef __ARCH_ALPHA_KERNEL_STATS_HH__
 #define __ARCH_ALPHA_KERNEL_STATS_HH__

-#include <map>
-#include <stack>
-#include <string>
-#include <vector>
-
-#include "cpu/static_inst.hh"
 #include "kern/kernel_stats.hh"

-class ThreadContext;
-
 namespace AlphaISA {
 namespace Kernel {

-enum cpu_mode { kernel, user, idle, cpu_mode_num };
-extern const char *modestr[];
-
-class Statistics : public ::Kernel::Statistics
-{
-  protected:
-    Addr idleProcess;
-    cpu_mode themode;
-    Tick lastModeTick;
-
-    void changeMode(cpu_mode newmode, ThreadContext *tc);
-
-  private:
-    Stats::Vector _callpal;
-
-    Stats::Scalar _hwrei;
-
-    Stats::Vector _mode;
-    Stats::Vector _modeGood;
-    Stats::Formula _modeFraction;
-    Stats::Vector _modeTicks;
-
-    Stats::Scalar _swap_context;
-
-    Stats::Vector _iplCount;
-    Stats::Vector _iplGood;
-    Stats::Vector _iplTicks;
-    Stats::Formula _iplUsed;
-
-  private:
-    int iplLast;
-    Tick iplLastTick;
-
-  public:
-    Statistics();
-
-    void regStats(const std::string &name);
-
-  public:
-    void mode(cpu_mode newmode, ThreadContext *tc);
-    void context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc);
-    void callpal(int code, ThreadContext *tc);
-    void hwrei() { _hwrei++; }
-    void swpipl(int ipl);
-
-    void setIdleProcess(Addr idle, ThreadContext *tc);
-
-  public:
-    void serialize(CheckpointOut &cp) const override;
-    void unserialize(CheckpointIn &cp) override;
-};
+class Statistics : public ::Kernel::Statistics {};

 } // namespace Kernel
 } // namespace AlphaISA

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/25148
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I4707d973402148401510697c95e2fea003a7a9e2
Gerrit-Change-Number: 25148
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to