CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
XrdAdaptor::QualityMetric Class Reference

#include <QualityMetric.h>

Inheritance diagram for XrdAdaptor::QualityMetric:
XrdAdaptor::QualityMetricSource XrdAdaptor::QualityMetricUniqueSource

Public Member Functions

unsigned get ()
 
 QualityMetric (timespec now, int default_value=260)
 

Private Member Functions

void finishWatch (timespec now, int ms)
 

Private Attributes

int m_interval0_n
 
time_t m_interval0_start
 
int m_interval0_val
 
int m_interval1_val
 
int m_interval2_val
 
int m_interval3_val
 
int m_interval4_val
 
std::mutex m_mutex
 
int m_value
 

Static Private Attributes

static const unsigned interval_length = 60
 

Friends

class QualityMetricWatch
 

Detailed Description

Definition at line 38 of file QualityMetric.h.

Constructor & Destructor Documentation

QualityMetric::QualityMetric ( timespec  now,
int  default_value = 260 
)

Member Function Documentation

void QualityMetric::finishWatch ( timespec  now,
int  ms 
)
private

Definition at line 79 of file QualityMetric.cc.

References interval_length, m_interval0_n, m_interval0_start, m_interval0_val, m_interval1_val, m_interval2_val, m_interval3_val, m_interval4_val, m_mutex, m_value, AnalysisDataFormats_SUSYBSMObjects::ms, and EgammaValidation_cff::num.

79  {
80  std::unique_lock<std::mutex> sentry(m_mutex);
81 
82  m_value = -1;
83  if (stop.tv_sec > m_interval0_start + interval_length) {
88  m_interval0_n = 1;
90  m_interval0_start = stop.tv_sec;
91  } else {
93  m_interval0_n++;
95  }
96 }
susybsm::MuonSegment ms
Definition: classes.h:31
static const unsigned interval_length
Definition: QualityMetric.h:48
unsigned QualityMetric::get ( void  )

Definition at line 98 of file QualityMetric.cc.

References CMS_THREAD_SAFE, XrdAdaptor::QualityMetricFactory::m_instance, m_interval0_val, m_interval1_val, m_interval2_val, m_interval3_val, m_interval4_val, m_mutex, and m_value.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), and betterConfigParser.BetterConfigParser::getResultingSection().

98  {
99  std::unique_lock<std::mutex> sentry(m_mutex);
100 
101  if (m_value == -1) {
102  unsigned den = 0;
103  m_value = 0;
104  if (m_interval0_val >= 0) {
105  den += 16;
106  m_value = 16 * m_interval0_val;
107  }
108  if (m_interval1_val >= 0) {
109  den += 8;
110  m_value += 8 * m_interval1_val;
111  }
112  if (m_interval2_val >= 0) {
113  den += 4;
114  m_value += 4 * m_interval2_val;
115  }
116  if (m_interval3_val >= 0) {
117  den += 2;
118  m_value += 2 * m_interval3_val;
119  }
120  if (m_interval4_val >= 0) {
121  den += 1;
123  }
124  if (den)
125  m_value /= den;
126  else
127  m_value = 260;
128  }
129  return m_value;
130 }

Friends And Related Function Documentation

friend class QualityMetricWatch
friend

Definition at line 39 of file QualityMetric.h.

Member Data Documentation

const unsigned XrdAdaptor::QualityMetric::interval_length = 60
staticprivate

Definition at line 48 of file QualityMetric.h.

Referenced by finishWatch().

int XrdAdaptor::QualityMetric::m_interval0_n
private

Definition at line 51 of file QualityMetric.h.

Referenced by finishWatch().

time_t XrdAdaptor::QualityMetric::m_interval0_start
private

Definition at line 53 of file QualityMetric.h.

Referenced by finishWatch().

int XrdAdaptor::QualityMetric::m_interval0_val
private

Definition at line 52 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval1_val
private

Definition at line 54 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval2_val
private

Definition at line 55 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval3_val
private

Definition at line 56 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval4_val
private

Definition at line 57 of file QualityMetric.h.

Referenced by finishWatch(), and get().

std::mutex XrdAdaptor::QualityMetric::m_mutex
private

Definition at line 59 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_value
private

Definition at line 50 of file QualityMetric.h.

Referenced by finishWatch(), and get().