CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
XrdAdaptor::XrdSiteStatisticsInformation Class Reference

#include <XrdStatistics.h>

Public Member Functions

std::shared_ptr< XrdSiteStatisticsgetStatisticsForSite (std::string const &site)
 

Static Public Member Functions

static XrdSiteStatisticsInformationgetInstance ()
 

Static Private Member Functions

static void createInstance ()
 

Private Attributes

std::mutex m_mutex
 
std::vector< edm::propagate_const< std::shared_ptr< XrdSiteStatistics > > > m_sites
 

Static Private Attributes

static std::atomic< XrdSiteStatisticsInformation * > m_instance
 

Friends

class XrdStatisticsService
 

Detailed Description

Definition at line 61 of file XrdStatistics.h.

Member Function Documentation

void XrdSiteStatisticsInformation::createInstance ( )
staticprivate

Definition at line 83 of file XrdStatistics.cc.

References tmp.

Referenced by XrdAdaptor::XrdStatisticsService::XrdStatisticsService().

84 {
85  if (!m_instance)
86  {
87  std::unique_ptr<XrdSiteStatisticsInformation> tmp { new XrdSiteStatisticsInformation() };
88  XrdSiteStatisticsInformation* expected = nullptr;
89  if (m_instance.compare_exchange_strong(expected,tmp.get()))
90  {
91  tmp.release();
92  }
93  }
94 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:73
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
XrdSiteStatisticsInformation * XrdSiteStatisticsInformation::getInstance ( )
static

Definition at line 97 of file XrdStatistics.cc.

Referenced by XrdAdaptor::XrdStatisticsService::condorUpdate(), XrdAdaptor::XrdStatisticsService::postEndJob(), and XrdAdaptor::Source::Source().

98 {
99  return m_instance.load(std::memory_order_relaxed);
100 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:73
std::shared_ptr< XrdSiteStatistics > XrdSiteStatisticsInformation::getStatisticsForSite ( std::string const &  site)

Definition at line 70 of file XrdStatistics.cc.

References edm::get_underlying_safe(), and CommonMethods::lock().

71 {
72  std::lock_guard<std::mutex> lock(m_mutex);
73  for (auto& stats : m_sites)
74  {
75  if (stats->site() == site) {return get_underlying_safe(stats);}
76  }
77  m_sites.emplace_back(new XrdSiteStatistics(site));
78  return get_underlying_safe(m_sites.back());
79 }
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)

Friends And Related Function Documentation

friend class XrdStatisticsService
friend

Definition at line 63 of file XrdStatistics.h.

Member Data Documentation

std::atomic< XrdSiteStatisticsInformation * > XrdSiteStatisticsInformation::m_instance
staticprivate

Definition at line 73 of file XrdStatistics.h.

std::mutex XrdAdaptor::XrdSiteStatisticsInformation::m_mutex
private

Definition at line 74 of file XrdStatistics.h.

Referenced by XrdAdaptor::XrdStatisticsService::condorUpdate().

std::vector<edm::propagate_const<std::shared_ptr<XrdSiteStatistics> > > XrdAdaptor::XrdSiteStatisticsInformation::m_sites
private