CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QualityMetric.h
Go to the documentation of this file.
1 #ifndef Utilities_XrdAdaptor_QualityMetric_h
2 #define Utilities_XrdAdaptor_QualityMetric_h
3 
4 #include <time.h>
5 
6 #include <mutex>
7 #include <memory>
8 #include <unordered_map>
9 
10 #include <boost/utility.hpp>
11 
12 namespace XrdAdaptor {
13 
14 class QualityMetric;
17 
18 class QualityMetricWatch : boost::noncopyable {
19 friend class QualityMetricSource;
20 
21 public:
25 
26  void swap(QualityMetricWatch &);
27 
28 private:
30  timespec m_start;
33 };
34 
35 class QualityMetric : boost::noncopyable {
36 friend class QualityMetricWatch;
37 
38 public:
39  QualityMetric(timespec now, int default_value=260);
40  unsigned get();
41 
42 private:
43  void finishWatch(timespec now, int ms);
44 
45  static const unsigned interval_length = 60;
46 
47  int m_value;
55 
57 };
58 
60 
61 friend class Source;
62 
63 private:
64  static
65  std::unique_ptr<QualityMetricSource> get(timespec now, const std::string &id);
66 
68 
69  typedef std::unordered_map<std::string, QualityMetricUniqueSource*> MetricMap;
71 };
72 
77 class QualityMetricSource final : public QualityMetric {
78 
80 
81 public:
83 
84 private:
85  QualityMetricSource(QualityMetricUniqueSource &parent, timespec now, int default_value);
86 
88 };
89 
90 /*
91  * This quality metric tracks all accesses to a given source ID.
92  */
94 
95 friend class QualityMetricFactory;
96 
97 private:
99  std::unique_ptr<QualityMetricSource> newSource(timespec now);
100 };
101 
102 }
103 
104 #endif // Utilities_XrdAdaptor_QualityMetric_h
105 
list parent
Definition: dbtoconf.py:74
static boost::mutex mutex
Definition: LHEProxy.cc:11
std::unique_ptr< QualityMetricSource > newSource(timespec now)
#define nullptr
QualityMetric(timespec now, int default_value=260)
QualityMetricUniqueSource & m_parent
Definition: QualityMetric.h:87
void finishWatch(timespec now, int ms)
QualityMetricSource(QualityMetricUniqueSource &parent, timespec now, int default_value)
std::unordered_map< std::string, QualityMetricUniqueSource * > MetricMap
Definition: QualityMetric.h:69
static QualityMetricFactory * m_instance
Definition: QualityMetric.h:67
susybsm::MuonSegment ms
Definition: classes.h:31
void startWatch(QualityMetricWatch &)
void swap(QualityMetricWatch &)
static const unsigned interval_length
Definition: QualityMetric.h:45