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

#include <perf.h>

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

Public Member Functions

virtual std::string label () const =0
 
virtual std::vector< Duration > & durations ()=0
 
virtual const std::vector< Duration > & durations () const =0
 
virtual void start ()=0
 
virtual void stop ()=0
 

Detailed Description

Probe API.

A Probe can be used to perform duration measurements.

The probe measures data associated to a given label(). Time measurements are performed between consecutive start() and end() calls, and added to the durations() list, so that they can be committed later to a Monitor.

example
fpmas::utils::perf::Probe probe("method_time");
probe.start();
call_some_method();
probe.end();
monitor.commit(probe);
// count() displays the number of ticks that corresponds
// to fpmas::api::utils::perf::Duration
std::cout << monitor.totalDuration("method_time").count() << std::endl;
Definition: perf.h:91
Duration totalDuration(std::string probe_label) const override
Definition: perf.cpp:34
void commit(api::utils::perf::Probe &probe) override
Definition: perf.cpp:21
Definition: perf.h:23

Member Function Documentation

◆ label()

virtual std::string fpmas::api::utils::perf::Probe::label ( ) const
pure virtual

Label associated to measured data.

Notice that it is allowed to have several Probes associated to the same label.

Returns
probe label

Implemented in fpmas::utils::perf::Probe.

◆ durations() [1/2]

virtual std::vector< Duration > & fpmas::api::utils::perf::Probe::durations ( )
pure virtual

Returns a reference to durations currently buffered within this probe.

Since a reference is returned, the buffer can eventually be cleared by an external process.

Returns
reference to currently buffered durations

Implemented in fpmas::utils::perf::Probe.

◆ durations() [2/2]

virtual const std::vector< Duration > & fpmas::api::utils::perf::Probe::durations ( ) const
pure virtual

Returns a reference to durations currently buffered within this probe.

Returns
reference to currently buffered durations

Implemented in fpmas::utils::perf::Probe.

◆ start()

virtual void fpmas::api::utils::perf::Probe::start ( )
pure virtual

Starts a duration measurement with this probe.

Note
Starting an already running Probe currently produces an undefined behavior.

Implemented in fpmas::utils::perf::Probe.

◆ stop()

virtual void fpmas::api::utils::perf::Probe::stop ( )
pure virtual

Stops a duration measurement, previously started with start().

The duration between start() and end() calls is added to durations().

Note
Stopping a Probe that is not running currently produces an undefined behavior.

Implemented in fpmas::utils::perf::Probe.


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