fpmas 1.6
Public Member Functions | List of all members
fpmas::api::utils::perf::Monitor Class Referenceabstract

#include <perf.h>

Inheritance diagram for fpmas::api::utils::perf::Monitor:
Inheritance graph
[legend]

Public Member Functions

virtual void commit (Probe &probe)=0
 
virtual std::size_t callCount (std::string probe_label) const =0
 
virtual Duration totalDuration (std::string probe_label) const =0
 
virtual void clear ()=0
 

Detailed Description

Monitor API.

A Monitor can be used to gather duration measurement performed by Probes.

Member Function Documentation

◆ commit()

virtual void fpmas::api::utils::perf::Monitor::commit ( Probe probe)
pure virtual

Commits measures performed by probe to this monitor.

  1. Durations contained in probe.durations() are added to the value returned by totalDuration(probe.label()).
  2. The count of durations in probe.durations() is added to the value returned by callCount(probe.label())
  3. The probe.durations() buffer is cleared.
Note
Committing a running Probe currently produces an undefined behavior.
Parameters
probeprobe to commit

Implemented in fpmas::utils::perf::Monitor.

◆ callCount()

virtual std::size_t fpmas::api::utils::perf::Monitor::callCount ( std::string  probe_label) const
pure virtual

Returns the total number of calls that has been performed (and committed) with Probes associated to probe_label.

A "call" is defined as a duration measurement, i.e. a pair of probe.start() / probe.stop() call.

If no probe with probe_label has been committed, 0 is returned.

Parameters
probe_labela Probe label
Returns
call count corresponding to probe_label

Implemented in fpmas::utils::perf::Monitor.

◆ totalDuration()

virtual Duration fpmas::api::utils::perf::Monitor::totalDuration ( std::string  probe_label) const
pure virtual

Returns the total duration of measurements performed (and committed) with Probes associated to probe_label.

If no probe with probe_label has been committed, a null duration is returned.

This methods returns an instance of fpmas::api::utils::perf::Duration, that is the default duration type associated to fpmas::api::utils::perf::Clock. However, this duration can be easily converted using the C++ standard library.

example
using namespace std::chrono;
auto duration_in_ms = duration_cast<milliseconds>(monitor.totalDuration("foo"))
Parameters
probe_labela Probe label
Returns
total duration of measures corresponding to probe_label

Implemented in fpmas::utils::perf::Monitor.

◆ clear()

virtual void fpmas::api::utils::perf::Monitor::clear ( )
pure virtual

Clears the monitor content.

Implemented in fpmas::utils::perf::Monitor.


The documentation for this class was generated from the following file: