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

Member Function Documentation

◆ createInstance()

void XrdSiteStatisticsInformation::createInstance ( )
staticprivate

Definition at line 82 of file XrdStatistics.cc.

References createJobs::tmp.

82  {
83  if (!m_instance) {
84  std::unique_ptr<XrdSiteStatisticsInformation> tmp{new XrdSiteStatisticsInformation()};
85  XrdSiteStatisticsInformation *expected = nullptr;
86  if (m_instance.compare_exchange_strong(expected, tmp.get())) {
87  tmp.release();
88  }
89  }
90 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:62
tmp
align.sh
Definition: createJobs.py:716

◆ getInstance()

XrdSiteStatisticsInformation * XrdSiteStatisticsInformation::getInstance ( )
static

Definition at line 92 of file XrdStatistics.cc.

92  {
93  return m_instance.load(std::memory_order_relaxed);
94 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:62

◆ getStatisticsForSite()

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

Definition at line 71 of file XrdStatistics.cc.

References edm::get_underlying_safe(), CommonMethods::lock(), das-up-to-nevents::site, and dqmMemoryStats::stats.

71  {
72  std::lock_guard<std::mutex> lock(m_mutex);
73  for (auto &stats : m_sites) {
74  if (stats->site() == site) {
75  return get_underlying_safe(stats);
76  }
77  }
78  m_sites.emplace_back(new XrdSiteStatistics(site));
79  return get_underlying_safe(m_sites.back());
80 }
std::vector< edm::propagate_const< std::shared_ptr< XrdSiteStatistics > > > m_sites
Definition: XrdStatistics.h:64
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)

Friends And Related Function Documentation

◆ XrdStatisticsService

friend class XrdStatisticsService
friend

Definition at line 52 of file XrdStatistics.h.

Member Data Documentation

◆ m_instance

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

Definition at line 62 of file XrdStatistics.h.

◆ m_mutex

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

Definition at line 63 of file XrdStatistics.h.

◆ m_sites

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

Definition at line 64 of file XrdStatistics.h.