gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: arch-arm: Add option to dump & reset stats on Arm PMU interrupt

RC
Richard Cooper (Gerrit)
Thu, Apr 20, 2023 6:19 PM

Richard Cooper has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/69958?usp=email )

Change subject: arch-arm: Add option to dump & reset stats on Arm PMU
interrupt
......................................................................

arch-arm: Add option to dump & reset stats on Arm PMU interrupt

Add an option dumpStatsOnInterrupt to ArmPMU.

This feature allows the PMU to be used to control the run of sampled
workloads which must run for a specified number of warmup and live
instructions. The stats will be reset when the PMU interrupts used to
count the instructions stream are triggered.

Change-Id: Ife02fe8e467dec91a2d4fda3f7dc9540a092f1ec

M src/arch/arm/ArmPMU.py
M src/arch/arm/pmu.cc
M src/arch/arm/pmu.hh
3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/arch/arm/ArmPMU.py b/src/arch/arm/ArmPMU.py
index 3eaed07..13c2e0b 100644
--- a/src/arch/arm/ArmPMU.py
+++ b/src/arch/arm/ArmPMU.py
@@ -221,5 +221,9 @@
# full implementation of FEAT_PMUv3p5.
use64bitCounters = Param.Bool(
False,

  •    "Choose whether to use 64-bit or " "32-bit PMEVCNTR<n>_EL0  
    

registers.",

  •    "Choose whether to use 64-bit or 32-bit PMEVCNTR<n>_EL0  
    

registers.",

  • )
  • dumpStatsOnInterrupt = Param.Bool(
  •    False, "Dump and reset staticstics on PMU interrupt."
    )
    

diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc
index 89dc2c8..b2c3147 100644
--- a/src/arch/arm/pmu.cc
+++ b/src/arch/arm/pmu.cc
@@ -46,6 +46,7 @@
#include "dev/arm/base_gic.hh"
#include "dev/arm/generic_timer.hh"
#include "params/ArmPMU.hh"
+#include "sim/stat_control.hh"

namespace gem5
{
@@ -57,6 +58,7 @@
PMU::PMU(const ArmPMUParams &p)
: SimObject(p), BaseISADevice(),
use64bitCounters(p.use64bitCounters),

  •  dumpStatsOnInterrupt(p.dumpStatsOnInterrupt),
      reg_pmcnten(0), reg_pmcr(0),
      reg_pmselr(0), reg_pminten(0), reg_pmovsr(0),
      reg_pmceid0(0),reg_pmceid1(0),
    

@@ -660,6 +662,10 @@
void
PMU::raiseInterrupt()
{

  • if (dumpStatsOnInterrupt) {

  •    // Dump stats, with reset, at curTick(), no-repeat
    
  •    statistics::schedStatEvent(true, true, curTick(), false);
    
  • }
    if (interrupt) {
    DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n");
    interrupt->raise();
    diff --git a/src/arch/arm/pmu.hh b/src/arch/arm/pmu.hh
    index ec60c6b..3594e8e 100644
    --- a/src/arch/arm/pmu.hh
    +++ b/src/arch/arm/pmu.hh
    @@ -576,6 +576,9 @@
    /** Determine whether to use 64-bit or 32-bit counters. */
    bool use64bitCounters;

  • /** Dump and reset statistics on PMU interrupt. */

  • bool dumpStatsOnInterrupt;

  • /** Performance Monitor Count Enable Register */
    RegVal reg_pmcnten;
    

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

Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ife02fe8e467dec91a2d4fda3f7dc9540a092f1ec
Gerrit-Change-Number: 69958
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Cooper richard.cooper@arm.com

Richard Cooper has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69958?usp=email ) Change subject: arch-arm: Add option to dump & reset stats on Arm PMU interrupt ...................................................................... arch-arm: Add option to dump & reset stats on Arm PMU interrupt Add an option `dumpStatsOnInterrupt` to ArmPMU. This feature allows the PMU to be used to control the run of sampled workloads which must run for a specified number of warmup and live instructions. The stats will be reset when the PMU interrupts used to count the instructions stream are triggered. Change-Id: Ife02fe8e467dec91a2d4fda3f7dc9540a092f1ec --- M src/arch/arm/ArmPMU.py M src/arch/arm/pmu.cc M src/arch/arm/pmu.hh 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/arch/arm/ArmPMU.py b/src/arch/arm/ArmPMU.py index 3eaed07..13c2e0b 100644 --- a/src/arch/arm/ArmPMU.py +++ b/src/arch/arm/ArmPMU.py @@ -221,5 +221,9 @@ # full implementation of FEAT_PMUv3p5. use64bitCounters = Param.Bool( False, - "Choose whether to use 64-bit or " "32-bit PMEVCNTR<n>_EL0 registers.", + "Choose whether to use 64-bit or 32-bit PMEVCNTR<n>_EL0 registers.", + ) + + dumpStatsOnInterrupt = Param.Bool( + False, "Dump and reset staticstics on PMU interrupt." ) diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc index 89dc2c8..b2c3147 100644 --- a/src/arch/arm/pmu.cc +++ b/src/arch/arm/pmu.cc @@ -46,6 +46,7 @@ #include "dev/arm/base_gic.hh" #include "dev/arm/generic_timer.hh" #include "params/ArmPMU.hh" +#include "sim/stat_control.hh" namespace gem5 { @@ -57,6 +58,7 @@ PMU::PMU(const ArmPMUParams &p) : SimObject(p), BaseISADevice(), use64bitCounters(p.use64bitCounters), + dumpStatsOnInterrupt(p.dumpStatsOnInterrupt), reg_pmcnten(0), reg_pmcr(0), reg_pmselr(0), reg_pminten(0), reg_pmovsr(0), reg_pmceid0(0),reg_pmceid1(0), @@ -660,6 +662,10 @@ void PMU::raiseInterrupt() { + if (dumpStatsOnInterrupt) { + // Dump stats, with reset, at curTick(), no-repeat + statistics::schedStatEvent(true, true, curTick(), false); + } if (interrupt) { DPRINTF(PMUVerbose, "Delivering PMU interrupt.\n"); interrupt->raise(); diff --git a/src/arch/arm/pmu.hh b/src/arch/arm/pmu.hh index ec60c6b..3594e8e 100644 --- a/src/arch/arm/pmu.hh +++ b/src/arch/arm/pmu.hh @@ -576,6 +576,9 @@ /** Determine whether to use 64-bit or 32-bit counters. */ bool use64bitCounters; + /** Dump and reset statistics on PMU interrupt. */ + bool dumpStatsOnInterrupt; + /** Performance Monitor Count Enable Register */ RegVal reg_pmcnten; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69958?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-MessageType: newchange Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: Ife02fe8e467dec91a2d4fda3f7dc9540a092f1ec Gerrit-Change-Number: 69958 Gerrit-PatchSet: 1 Gerrit-Owner: Richard Cooper <richard.cooper@arm.com>