Medida
metrics_registry.h
00001 //
00002 // Copyright (c) 2012 Daniel Lundin
00003 //
00004 
00005 #ifndef MEDIDA_METRICS_REGISTRY_H_
00006 #define MEDIDA_METRICS_REGISTRY_H_
00007 
00008 #include <cstdint>
00009 #include <map>
00010 #include <memory>
00011 #include <string>
00012 
00013 #include "medida/counter.h"
00014 #include "medida/histogram.h"
00015 #include "medida/meter.h"
00016 #include "medida/metric_interface.h"
00017 #include "medida/metric_name.h"
00018 #include "medida/metric_processor.h"
00019 #include "medida/timer.h"
00020 
00021 namespace medida {
00022 
00023 class MetricsRegistry {
00024  public:
00025   MetricsRegistry();
00026   ~MetricsRegistry();
00027   Counter& NewCounter(const MetricName &name, std::int64_t init_value = 0);
00028   Histogram& NewHistogram(const MetricName &name,
00029       SamplingInterface::SampleType sample_type = SamplingInterface::kUniform);
00030   Meter& NewMeter(const MetricName &name, std::string event_type, 
00031       Clock::duration rate_unit = std::chrono::seconds(1));
00032   Timer& NewTimer(const MetricName &name,
00033       std::chrono::nanoseconds duration_unit = std::chrono::milliseconds(1),
00034       std::chrono::nanoseconds rate_unit = std::chrono::seconds(1));
00035   std::map<MetricName, std::shared_ptr<MetricInterface>> GetAllMetrics() const;
00036  private:
00037   class Impl;
00038   std::unique_ptr<Impl> impl_;
00039 };
00040 
00041 } // namespace medida
00042 
00043 #endif // MEDIDA_METRICS_REGISTRY_H_
 All Classes