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 91 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 pileupDistInMC::num.

92 {
93  std::unique_lock<std::mutex> sentry(m_mutex);
94 
95  m_value = -1;
96  if (stop.tv_sec > m_interval0_start+interval_length)
97  {
102  m_interval0_n = 1;
104  m_interval0_start = stop.tv_sec;
105  }
106  else
107  {
109  m_interval0_n++;
111  }
112 }
susybsm::MuonSegment ms
Definition: classes.h:31
static const unsigned interval_length
Definition: QualityMetric.h:48
unsigned QualityMetric::get ( void  )

Definition at line 115 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(), and betterConfigParser.BetterConfigParser::getResultingSection().

116 {
117  std::unique_lock<std::mutex> sentry(m_mutex);
118 
119  if (m_value == -1)
120  {
121  unsigned den = 0;
122  m_value = 0;
123  if (m_interval0_val >= 0)
124  {
125  den += 16;
127  }
128  if (m_interval1_val >= 0)
129  {
130  den += 8;
132  }
133  if (m_interval2_val >= 0)
134  {
135  den += 4;
137  }
138  if (m_interval3_val >= 0)
139  {
140  den += 2;
142  }
143  if (m_interval4_val >= 0)
144  {
145  den += 1;
147  }
148  if (den)
149  m_value /= den;
150  else
151  m_value = 260;
152  }
153  return m_value;
154 }

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().