2 #ifndef _BANDWIDTH_MONITOR_INL_ 3 #define _BANDWIDTH_MONITOR_INL_ 11 MADARA_GUARD_TYPE guard (
mutex_);
13 time_t cur_time = time (NULL);
14 time_t earliest_time = cur_time -
window_;
16 BandwidthMessages::iterator begin =
messages_.begin ();
17 BandwidthMessages::iterator end = begin;
19 for (end = begin; end !=
messages_.end (); ++end)
25 if (end->first < earliest_time)
39 #endif // _BANDWIDTH_MONITOR_INL_ MADARA_LOCK_TYPE mutex_
Mutex for supporting multithreaded monitor calls.
time_t update_utilization(void)
Updates utilization for most public functions.
BandwidthMessages messages_
Map of timestamps to messages.
uint64_t utilization_
Utilization.
time_t window_
Time window for useful messages to bandwidth calculations.