Add a function to check if a probe has listeners. This can be
used to avoid performing costly tasks when no one is listening.
Change-Id: I8996a0ea298cb7cf97ac8aa9e627331a22bea26e
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38175
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
{
}
+ /**
+ * Informs whether any listeners are attached to this probe. This can
+ * be used to avoid performing costly tasks needed by the probe when
+ * nobody is listening.
+ *
+ * @return Whether this probe has any listener.
+ */
+ bool hasListeners() const { return listeners.size() > 0; }
+
/**
* @brief adds a ProbeListener to this ProbePoints notify list.
* @param l the ProbeListener to add to the notify list.