sim: Add a listener checker to probes

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>
This commit is contained in:
Daniel R. Carvalho
2020-12-01 15:24:56 +01:00
committed by Daniel Carvalho
parent 275a6ecefe
commit 9388ec18a4

View File

@@ -261,6 +261,15 @@ class ProbePointArg : public ProbePoint
{
}
/**
* 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.