CMS 3D CMS Logo

List of all members | Classes | Public Member Functions
XrdAdaptor::XrdStatisticsService Class Reference

#include <XrdStatistics.h>

Classes

struct  CondorIOStats
 

Public Member Functions

std::vector< std::pair< std::string, CondorIOStats > > condorUpdate ()
 
void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
void postEndJob ()
 
 XrdStatisticsService (const edm::ParameterSet &iPS, edm::ActivityRegistry &iRegistry)
 

Detailed Description

Definition at line 39 of file XrdStatistics.h.

Constructor & Destructor Documentation

XrdStatisticsService::XrdStatisticsService ( const edm::ParameterSet iPS,
edm::ActivityRegistry iRegistry 
)

Definition at line 20 of file XrdStatistics.cc.

References XrdAdaptor::XrdSiteStatisticsInformation::createInstance(), edm::ParameterSet::getUntrackedParameter(), postEndJob(), and edm::ActivityRegistry::watchPostEndJob().

21 {
23 
24  if (iPS.getUntrackedParameter<bool>("reportToFJR", false))
25  {
27  }
28 }
T getUntrackedParameter(std::string const &, T const &) const
void watchPostEndJob(PostEndJob::slot_type const &iSlot)

Member Function Documentation

std::vector< std::pair< std::string, XrdStatisticsService::CondorIOStats > > XrdStatisticsService::condorUpdate ( )

Definition at line 48 of file XrdStatistics.cc.

References XrdAdaptor::XrdStatisticsService::CondorIOStats::bytesRead, fwrapper::cs, edm::get_underlying_safe(), XrdAdaptor::XrdSiteStatisticsInformation::getInstance(), instance, CommonMethods::lock(), XrdAdaptor::XrdSiteStatisticsInformation::m_mutex, XrdAdaptor::XrdSiteStatisticsInformation::m_sites, mps_fire::result, and XrdAdaptor::XrdStatisticsService::CondorIOStats::transferTime.

Referenced by edm::service::CondorStatusService::updateImpl().

49 {
50  std::vector<std::pair<std::string, XrdStatisticsService::CondorIOStats>> result;
52  if (!instance) {return result;}
53 
54  std::lock_guard<std::mutex> lock(instance->m_mutex);
55  result.reserve(instance->m_sites.size());
56  for (auto& stats : instance->m_sites)
57  {
58  CondorIOStats cs;
59  std::shared_ptr<XrdSiteStatistics> ss = get_underlying_safe(stats);
60  if (!ss) continue;
61  cs.bytesRead = ss->getTotalBytes();
62  cs.transferTime = ss->getTotalReadTime();
63  result.emplace_back(ss->site(), cs);
64  }
65  return result;
66 }
static PFTauRenderPlugin instance
unique_ptr< ClusterSequence > cs
std::vector< edm::propagate_const< std::shared_ptr< XrdSiteStatistics > > > m_sites
Definition: XrdStatistics.h:75
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
static XrdSiteStatisticsInformation * getInstance()
void XrdStatisticsService::fillDescriptions ( edm::ConfigurationDescriptions descriptions)

Definition at line 102 of file XrdStatistics.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), and edm::ParameterSetDescription::setComment().

103 {
105  desc.setComment("Report Xrootd-related statistics centrally.");
106  desc.addUntracked<bool>("reportToFJR", true)
107  ->setComment("True: Add per-site Xrootd statistics to the framework job report.\n"
108  "False: Collect no site-specific statistics.\n");
109  descriptions.add("XrdAdaptor::XrdStatisticsService", desc);
110 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void XrdStatisticsService::postEndJob ( )

Definition at line 31 of file XrdStatistics.cc.

References XrdAdaptor::XrdSiteStatisticsInformation::getInstance(), instance, edm::Service< T >::isAvailable(), XrdAdaptor::XrdSiteStatisticsInformation::m_sites, and edm::JobReport::reportPerformanceForModule().

Referenced by XrdStatisticsService().

32 {
34  if (!reportSvc.isAvailable()) {return;}
35 
37  if (!instance) {return;}
38 
39  std::map<std::string, std::string> props;
40  for (auto& stats : instance->m_sites)
41  {
42  stats->recomputeProperties(props);
43  reportSvc->reportPerformanceForModule(stats->site(), "XrdSiteStatistics", props);
44  }
45 }
static PFTauRenderPlugin instance
std::vector< edm::propagate_const< std::shared_ptr< XrdSiteStatistics > > > m_sites
Definition: XrdStatistics.h:75
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
Definition: JobReport.cc:672
bool isAvailable() const
Definition: Service.h:40
static XrdSiteStatisticsInformation * getInstance()