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 55 of file XrdStatistics.h.

Member Function Documentation

◆ createInstance()

void XrdSiteStatisticsInformation::createInstance ( )
staticprivate

Definition at line 76 of file XrdStatistics.cc.

76  {
77  if (!m_instance) {
78  std::unique_ptr<XrdSiteStatisticsInformation> tmp{new XrdSiteStatisticsInformation()};
79  XrdSiteStatisticsInformation *expected = nullptr;
80  if (m_instance.compare_exchange_strong(expected, tmp.get())) {
81  tmp.release();
82  }
83  }
84 }

References m_instance, and createJobs::tmp.

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

◆ getInstance()

XrdSiteStatisticsInformation * XrdSiteStatisticsInformation::getInstance ( )
static

Definition at line 86 of file XrdStatistics.cc.

86  {
87  return m_instance.load(std::memory_order_relaxed);
88 }

References m_instance.

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

◆ getStatisticsForSite()

std::shared_ptr< XrdSiteStatistics > XrdSiteStatisticsInformation::getStatisticsForSite ( std::string const &  site)

Definition at line 65 of file XrdStatistics.cc.

65  {
66  std::lock_guard<std::mutex> lock(m_mutex);
67  for (auto &stats : m_sites) {
68  if (stats->site() == site) {
69  return get_underlying_safe(stats);
70  }
71  }
72  m_sites.emplace_back(new XrdSiteStatistics(site));
73  return get_underlying_safe(m_sites.back());
74 }

References edm::get_underlying_safe(), CommonMethods::lock(), m_mutex, m_sites, and dqmMemoryStats::stats.

Friends And Related Function Documentation

◆ XrdStatisticsService

friend class XrdStatisticsService
friend

Definition at line 56 of file XrdStatistics.h.

Member Data Documentation

◆ m_instance

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

Definition at line 66 of file XrdStatistics.h.

Referenced by createInstance(), and getInstance().

◆ m_mutex

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

Definition at line 67 of file XrdStatistics.h.

Referenced by getStatisticsForSite().

◆ m_sites

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

Definition at line 68 of file XrdStatistics.h.

Referenced by getStatisticsForSite().

XrdAdaptor::XrdSiteStatisticsInformation
Definition: XrdStatistics.h:55
XrdAdaptor::XrdSiteStatisticsInformation::m_mutex
std::mutex m_mutex
Definition: XrdStatistics.h:67
XrdAdaptor::XrdSiteStatistics
Definition: XrdStatistics.h:71
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
XrdAdaptor::XrdSiteStatisticsInformation::m_sites
std::vector< edm::propagate_const< std::shared_ptr< XrdSiteStatistics > > > m_sites
Definition: XrdStatistics.h:68
edm::get_underlying_safe
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:40
CommonMethods.lock
def lock()
Definition: CommonMethods.py:82
XrdAdaptor::XrdSiteStatisticsInformation::m_instance
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:66
dqmMemoryStats.stats
stats
Definition: dqmMemoryStats.py:134