14 using namespace edm::storage;
16 namespace xrd_adaptor {
17 XrdStatistics::~XrdStatistics() {}
20 using namespace XrdAdaptor;
22 std::atomic<XrdSiteStatisticsInformation *> XrdSiteStatisticsInformation::m_instance;
25 XrdSiteStatisticsInformation::createInstance();
32 void XrdStatisticsService::postEndJob() {
43 std::map<std::string, std::string> props;
45 stats->recomputeProperties(props);
50 std::vector<std::pair<std::string, XrdStatisticsService::CondorIOStats>> XrdStatisticsService::condorUpdate() {
51 std::vector<std::pair<std::string, XrdStatisticsService::CondorIOStats>>
result;
57 std::lock_guard<std::mutex>
lock(instance->
m_mutex);
58 result.reserve(instance->
m_sites.size());
66 result.emplace_back(ss->site(),
cs);
71 std::shared_ptr<XrdSiteStatistics> XrdSiteStatisticsInformation::getStatisticsForSite(
std::string const &site) {
72 std::lock_guard<std::mutex>
lock(m_mutex);
73 for (
auto &
stats : m_sites) {
74 if (
stats->site() == site) {
82 void XrdSiteStatisticsInformation::createInstance() {
86 if (m_instance.compare_exchange_strong(expected,
tmp.get())) {
93 return m_instance.load(std::memory_order_relaxed);
98 desc.
setComment(
"Report Xrootd-related statistics centrally.");
101 "True: Add per-site Xrootd statistics to the framework job report.\n"
102 "False: Collect no site-specific statistics.\n");
103 descriptions.
add(
"XrdStatisticsService", desc);
117 std::shared_ptr<ClientRequest> req) {
118 std::shared_ptr<XrdReadStatistics> readStats(
new XrdReadStatistics(parent, req->getSize(), req->getCount()));
123 std::ostringstream formatter;
125 return formatter.str();
129 std::ostringstream formatter;
130 formatter << std::setw(4) <<
input;
131 return formatter.str();
139 props[
"readv-totalMegabytes"] =
d2str(static_cast<float>(
m_readvSize) / (1024.0 * 1024.0));
143 props[
"read-totalMegabytes"] =
d2str(static_cast<float>(
m_readSize) / (1024.0 * 1024.0));
144 props[
"read-totalMsecs"] =
d2str(static_cast<float>(
m_readNS) / 1e6);
161 : m_size(size), m_count(count), m_parent(parent), m_start(std::chrono::high_resolution_clock::
now()) {}
T getUntrackedParameter(std::string const &, T const &) const
XrdReadStatistics(const XrdReadStatistics &)=delete
boost::date_time::subsecond_duration< boost::posix_time::time_duration, 1000000000 > nanoseconds
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
std::atomic< unsigned > m_readCount
static PFTauRenderPlugin instance
unique_ptr< ClusterSequence > cs
std::chrono::nanoseconds transferTime
void finishRead(XrdReadStatistics const &)
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::atomic< uint64_t > m_readvSize
static std::string d2str(double input)
static std::string const input
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
void recomputeProperties(std::map< std::string, std::string > &props)
void setComment(std::string const &value)
static std::shared_ptr< XrdReadStatistics > startRead(std::shared_ptr< XrdSiteStatistics > parent, std::shared_ptr< ClientRequest > req)
std::atomic< unsigned > m_readvCount
uint64_t elapsedNS() const
std::atomic< uint64_t > m_readvNS
std::atomic< uint64_t > m_readNS
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::chrono::time_point< std::chrono::high_resolution_clock > m_start
unsigned long long uint64_t
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static std::string i2str(int input)
std::atomic< uint64_t > m_readSize
friend class XrdReadStatistics
tuple size
Write out results.
std::atomic< unsigned > m_chunkCount