10 #include <mach/clock.h>
11 #include <mach/mach.h>
12 #define GET_CLOCK_MONOTONIC(ts) \
14 clock_serv_t cclock; \
15 mach_timespec_t mts; \
16 host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); \
17 clock_get_time(cclock, &mts); \
18 mach_port_deallocate(mach_task_self(), cclock); \
19 ts.tv_sec = mts.tv_sec; \
20 ts.tv_nsec = mts.tv_nsec; \
23 #define GET_CLOCK_MONOTONIC(ts) clock_gettime(CLOCK_MONOTONIC, &ts);
26 using namespace XrdAdaptor;
29 : m_parent1(parent1), m_parent2(parent2) {
39 int ms = 1000 * (stop.tv_sec -
m_start.tv_sec) + (stop.tv_nsec -
m_start.tv_nsec) / 1e6;
40 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Finished timer after " << ms << std::endl;
50 that.m_parent1 =
nullptr;
51 that.m_parent2 =
nullptr;
52 that.m_start = {0, 0};
70 : m_value(default_value),
73 m_interval0_start(now.tv_sec),
77 m_interval4_val(-1) {}
80 std::unique_lock<std::mutex> sentry(
m_mutex);
99 std::unique_lock<std::mutex> sentry(
m_mutex);
140 itFound = insertResult.first;
141 if (insertResult.second) {
145 return itFound->second->newSource(now);
Log< level::Info, true > LogVerbatim
std::unique_ptr< QualityMetricSource > newSource(timespec now)
QualityMetric(timespec now, int default_value=260)
edm::propagate_const< QualityMetric * > m_parent1
QualityMetricUniqueSource & m_parent
void finishWatch(timespec now, int ms)
#define GET_CLOCK_MONOTONIC(ts)
static std::unique_ptr< QualityMetricSource > get(timespec now, const std::string &id)
QualityMetricSource(QualityMetricUniqueSource &parent, timespec now, int default_value)
void startWatch(QualityMetricWatch &)
void swap(QualityMetricWatch &)
edm::propagate_const< QualityMetric * > m_parent2
static const unsigned interval_length
static std::string const source
static QualityMetricFactory m_instance
QualityMetricUniqueSource(timespec now)