CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ()
 
QualityMetricoperator= (const QualityMetric &)=delete
 
 QualityMetric (timespec now, int default_value=260)
 
 QualityMetric (const QualityMetric &)=delete
 

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 40 of file QualityMetric.h.

Constructor & Destructor Documentation

QualityMetric::QualityMetric ( timespec  now,
int  default_value = 260 
)
XrdAdaptor::QualityMetric::QualityMetric ( const QualityMetric )
delete

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, and pileupDistInMC::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;
89  m_interval0_val = ms;
90  m_interval0_start = stop.tv_sec;
91  } else {
92  int num = m_interval0_val * m_interval0_n + ms;
93  m_interval0_n++;
95  }
96 }
static const unsigned interval_length
Definition: QualityMetric.h:53
unsigned QualityMetric::get ( void  )

Definition at line 98 of file QualityMetric.cc.

References 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(), submitPVValidationJobs.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), and submitPVValidationJobs.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 }
QualityMetric& XrdAdaptor::QualityMetric::operator= ( const QualityMetric )
delete

Friends And Related Function Documentation

friend class QualityMetricWatch
friend

Definition at line 41 of file QualityMetric.h.

Member Data Documentation

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

Definition at line 53 of file QualityMetric.h.

Referenced by finishWatch().

int XrdAdaptor::QualityMetric::m_interval0_n
private

Definition at line 56 of file QualityMetric.h.

Referenced by finishWatch().

time_t XrdAdaptor::QualityMetric::m_interval0_start
private

Definition at line 58 of file QualityMetric.h.

Referenced by finishWatch().

int XrdAdaptor::QualityMetric::m_interval0_val
private

Definition at line 57 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval1_val
private

Definition at line 59 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval2_val
private

Definition at line 60 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval3_val
private

Definition at line 61 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_interval4_val
private

Definition at line 62 of file QualityMetric.h.

Referenced by finishWatch(), and get().

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

Definition at line 64 of file QualityMetric.h.

Referenced by finishWatch(), and get().

int XrdAdaptor::QualityMetric::m_value
private

Definition at line 55 of file QualityMetric.h.

Referenced by finishWatch(), and get().