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

#include <perf.h>

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

Public Member Functions

void commit (api::utils::perf::Probe &probe) override
 
std::size_t callCount (std::string probe_label) const override
 
Duration totalDuration (std::string probe_label) const override
 
void clear () override
 
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

fpmas::api::utils::perf::Monitor implementation.

Member Function Documentation

◆ commit()

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

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

Implements fpmas::api::utils::perf::Monitor.

◆ callCount()

std::size_t fpmas::utils::perf::Monitor::callCount ( std::string  probe_label) const
overridevirtual

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

Implements fpmas::api::utils::perf::Monitor.

◆ totalDuration()

Duration fpmas::utils::perf::Monitor::totalDuration ( std::string  probe_label) const
overridevirtual

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

Implements fpmas::api::utils::perf::Monitor.

◆ clear()

void fpmas::utils::perf::Monitor::clear ( )
overridevirtual

Clears the monitor content.

Implements fpmas::api::utils::perf::Monitor.


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