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) \ 24 clock_gettime(CLOCK_MONOTONIC, &ts); 31 : m_parent1(parent1), m_parent2(parent2)
44 int ms = 1000*(stop.tv_sec -
m_start.tv_sec) + (stop.tv_nsec -
m_start.tv_nsec)/1e6;
45 edm::LogVerbatim(
"XrdAdaptorInternal") <<
"Finished timer after " << ms << std::endl;
56 that.m_parent1 =
nullptr;
57 that.m_parent2 =
nullptr;
58 that.m_start = {0, 0};
79 : m_value(default_value),
82 m_interval0_start(now.tv_sec),
93 std::unique_lock<std::mutex> sentry(
m_mutex);
117 std::unique_lock<std::mutex> sentry(
m_mutex);
160 std::unique_ptr<QualityMetricSource>
163 auto itFound = m_instance.m_sources.find(
id);
164 if (itFound == m_instance.m_sources.end())
168 auto insertResult = m_instance.m_sources.insert(std::make_pair(
id, source.get()));
169 itFound = insertResult.first;
170 if (insertResult.second)
175 return itFound->second->newSource(now);
195 std::unique_ptr<QualityMetricSource>
edm::propagate_const< QualityMetric * > m_parent2
std::unique_ptr< QualityMetricSource > newSource(timespec now)
QualityMetric(timespec now, int default_value=260)
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)
std::vector< std::vector< double > > tmp
void startWatch(QualityMetricWatch &)
void swap(QualityMetricWatch &)
static const unsigned interval_length
static std::string const source
static QualityMetricFactory m_instance
QualityMetricUniqueSource(timespec now)
edm::propagate_const< QualityMetric * > m_parent1