Fawkes API  Fawkes Development Version
syncpoint_call_stats.h
1 /***************************************************************************
2  * syncpoint_call_stats.h - Utility class to keep track of SP call stats
3  *
4  * Created: Fri Aug 15 16:17:42 2014
5  * Copyright 2014 Till Hofmann
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef _SYNCPOINT_SYNCPOINT_CALL_STATS_H_
23 #define _SYNCPOINT_SYNCPOINT_CALL_STATS_H_
24 
25 #include <syncpoint/syncpoint_call.h>
26 #include <utils/time/time.h>
27 
28 namespace fawkes {
29 
31 {
32 public:
34 
35  void update_calls(const Time &new_call, const Time &wait_time = Time(0.f));
36  void update_calls(const SyncPointCall &call);
37  Time get_first_call() const;
38  Time get_last_call() const;
39  float get_call_frequency() const;
40  float get_waittime_average() const;
41  unsigned int get_num_calls() const;
42 
43 private:
44  Time first_call_;
45  Time last_call_;
46  Time total_wait_time_;
47  unsigned int num_calls_;
48 };
49 
50 } // namespace fawkes
51 
52 #endif
fawkes::SyncPointCallStats::update_calls
void update_calls(const Time &new_call, const Time &wait_time=Time(0.f))
Add a call to the stats.
Definition: syncpoint_call_stats.cpp:47
fawkes::SyncPointCallStats
This class represents call stats of a single component to a single SyncPoint.
Definition: syncpoint_call_stats.h:31
fawkes::SyncPointCallStats::get_waittime_average
float get_waittime_average() const
Get the average wait time.
Definition: syncpoint_call_stats.cpp:103
fawkes::SyncPointCallStats::get_last_call
Time get_last_call() const
Get the last call to the SyncPoint by the component.
Definition: syncpoint_call_stats.cpp:81
fawkes::SyncPointCall
A call (wait() or emit()) to a SyncPoint.
Definition: syncpoint_call.h:32
fawkes::SyncPointCallStats::get_first_call
Time get_first_call() const
Get the first call to the SyncPoint by the component.
Definition: syncpoint_call_stats.cpp:72
fawkes
Fawkes library namespace.
fawkes::SyncPointCallStats::SyncPointCallStats
SyncPointCallStats()
Constructor.
Definition: syncpoint_call_stats.cpp:36
fawkes::Time
A class for handling time.
Definition: time.h:93
fawkes::SyncPointCallStats::get_num_calls
unsigned int get_num_calls() const
Get total number of calls.
Definition: syncpoint_call_stats.cpp:112
fawkes::SyncPointCallStats::get_call_frequency
float get_call_frequency() const
Get the call frequency.
Definition: syncpoint_call_stats.cpp:91