Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38699 )

Change subject: sim,arch-arm: Allow enabling and disabling probe listeners
......................................................................

sim,arch-arm: Allow enabling and disabling probe listeners

Let probe listeners be enabled or disabled regarding receiving
and processing notifications.

Jira: https://gem5.atlassian.net/browse/GEM5-857

Change-Id: Ia8118e6cd28a9bb9683edd4f71aa665e096e08a9
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
---
M src/arch/arm/pmu.cc
M src/arch/arm/pmu.hh
M src/sim/probe/probe.cc
M src/sim/probe/probe.hh
4 files changed, 34 insertions(+), 17 deletions(-)



diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc
index 51dfdca..6de7a8e 100644
--- a/src/arch/arm/pmu.cc
+++ b/src/arch/arm/pmu.cc
@@ -474,16 +474,17 @@
 void
 PMU::RegularEvent::enable()
 {
-    for (auto& subEvents: microArchitectureEventSet) {
-        attachedProbePointList.emplace_back(
-            new RegularProbe(this, subEvents.first, subEvents.second));
+    for (auto &listener : attachedProbePointList) {
+        listener->enable();
     }
 }

 void
 PMU::RegularEvent::disable()
 {
-    attachedProbePointList.clear();
+    for (auto &listener : attachedProbePointList) {
+        listener->disable();
+    }
 }

 bool
diff --git a/src/arch/arm/pmu.hh b/src/arch/arm/pmu.hh
index 3cdcf1c..65781b8 100644
--- a/src/arch/arm/pmu.hh
+++ b/src/arch/arm/pmu.hh
@@ -340,16 +340,15 @@
         std::set<PMU::CounterState*> userCounters;
     };

-    struct RegularEvent : public PMUEvent {
-        typedef std::pair<SimObject*, std::string> EventTypeEntry;
-
-        void addMicroarchitectureProbe(SimObject* object,
-            std::string name) {
-
+    struct RegularEvent : public PMUEvent
+    {
+        void
+        addMicroarchitectureProbe(SimObject* object, std::string name)
+        {
             panic_if(!object,"malformed probe-point"
                 " definition with name %s\n", name);
-
-            microArchitectureEventSet.emplace(object, name);
+            attachedProbePointList.emplace_back(
+                new RegularProbe(this, object, name));
         }

       protected:
@@ -368,9 +367,6 @@
             RegularEvent *parentEvent;
         };

-        /** The set of events driving the event value **/
-        std::set<EventTypeEntry> microArchitectureEventSet;
-
/** Set of probe listeners tapping onto each of the input micro-arch
          *  events which compose this pmu event
          */
diff --git a/src/sim/probe/probe.cc b/src/sim/probe/probe.cc
index c4e74a5..656ea8e 100644
--- a/src/sim/probe/probe.cc
+++ b/src/sim/probe/probe.cc
@@ -66,7 +66,7 @@
 }

ProbeListener::ProbeListener(ProbeManager *_manager, const std::string &_name)
-    : manager(_manager), name(_name)
+    : manager(_manager), name(_name), _enabled(true)
 {
     manager->addListener(name, *this);
 }
diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh
index 8078a18..5c72126 100644
--- a/src/sim/probe/probe.hh
+++ b/src/sim/probe/probe.hh
@@ -129,9 +129,27 @@
     ProbeListener(ProbeListener&& other) noexcept = delete;
     ProbeListener& operator=(ProbeListener&& other) noexcept = delete;

+
+    /** Allow this probe to receive notifications. */
+    void enable() { _enabled = true; }
+
+    /** Disallow this probe to receive notifications. */
+    void disable() { _enabled = false; }
+
+    /**
+     * Whether this listener is allowed to receive notifications.
+     *
+     * @return True if this listener can process notifications.
+     */
+    bool enabled() const { return _enabled; }
+
   protected:
     ProbeManager *const manager;
     const std::string name;
+
+  private:
+    /** Whether this listener processes notifications. */
+    bool _enabled;
 };

 /**
@@ -329,7 +347,9 @@
     notify(const Arg &arg)
     {
         for (auto l = listeners.begin(); l != listeners.end(); ++l) {
-            (*l)->notify(arg);
+            if ((*l)->enabled()) {
+                (*l)->notify(arg);
+            }
         }
     }
 };

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

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ia8118e6cd28a9bb9683edd4f71aa665e096e08a9
Gerrit-Change-Number: 38699
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to