16 #ifndef IMPALA_UTIL_PERIODIC_COUNTER_UPDATER_H
17 #define IMPALA_UTIL_PERIODIC_COUNTER_UPDATER_H
19 #include <boost/function.hpp>
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/thread/mutex.hpp>
22 #include <boost/thread/thread.hpp>
23 #include <boost/unordered_map.hpp>
24 #include <boost/unordered_set.hpp>
58 std::vector<RuntimeProfile::Counter*>* buckets);
112 typedef boost::unordered_map<RuntimeProfile::Counter*, RateCounterInfo>
RateCounterMap;
120 typedef boost::unordered_map<RuntimeProfile::Counter*, SamplingCounterInfo>
128 typedef boost::unordered_map<std::vector<RuntimeProfile::Counter*>*,
BucketCountersInfo>
boost::scoped_ptr< boost::thread > update_thread_
Thread performing asynchronous updates.
RuntimeProfile::Counter * src_counter
RateCounterMap rate_counters_
static void RegisterTimeSeriesCounter(RuntimeProfile::TimeSeriesCounter *counter)
Adds counter to be sampled and updated at regular intervals.
~PeriodicCounterUpdater()
Tears down the update thread.
AtomicInt< uint32_t > done_
If 1, tear down the update thread.
static void RegisterPeriodicCounter(RuntimeProfile::Counter *src_counter, RuntimeProfile::DerivedCounterFunction sample_fn, RuntimeProfile::Counter *dst_counter, PeriodicCounterType type)
boost::function< int64_t()> DerivedCounterFunction
boost::unordered_map< std::vector< RuntimeProfile::Counter * > *, BucketCountersInfo > BucketCountersMap
Map from a bucket of counters to the src counter.
RuntimeProfile::DerivedCounterFunction sample_fn
SpinLock rate_lock_
Spinlock that protects the map of rate counters.
RuntimeProfile::Counter * src_counter
static void StopBucketingCounters(std::vector< RuntimeProfile::Counter * > *buckets, bool convert)
TimeSeriesCounters time_series_counters_
RuntimeProfile::Counter * src_counter
boost::unordered_map< RuntimeProfile::Counter *, RateCounterInfo > RateCounterMap
A map of the dst (rate) counter to the src counter and elapsed time.
static void StopRateCounter(RuntimeProfile::Counter *counter)
Stops updating the value of 'counter'.
SamplingCounterMap sampling_counters_
SpinLock sampling_lock_
Spinlock that protects the map of averages over samples of counters.
static void RegisterBucketingCounters(RuntimeProfile::Counter *src_counter, std::vector< RuntimeProfile::Counter * > *buckets)
Adds a bucketing counter to be updated at regular intervals.
SpinLock bucketing_lock_
Spinlock that protects the map of buckets of counters.
static PeriodicCounterUpdater state_
boost::unordered_set< RuntimeProfile::TimeSeriesCounter * > TimeSeriesCounters
Set of time series counters that need to be updated.
static void StopSamplingCounter(RuntimeProfile::Counter *counter)
Stops updating the value of 'counter'.
SpinLock time_series_lock_
Spinlock that protects the map of time series counters.
boost::unordered_map< RuntimeProfile::Counter *, SamplingCounterInfo > SamplingCounterMap
BucketCountersMap bucketing_counters_
int64_t total_sampled_value
RuntimeProfile::DerivedCounterFunction sample_fn
static void StopTimeSeriesCounter(RuntimeProfile::TimeSeriesCounter *counter)
Stops 'counter' from receiving any more samples.