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

void XrdSiteStatisticsInformation::createInstance ( )
staticprivate

Definition at line 76 of file XrdStatistics.cc.

References createJobs::tmp.

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

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 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:66
tmp
align.sh
Definition: createJobs.py:716
XrdSiteStatisticsInformation * XrdSiteStatisticsInformation::getInstance ( )
static

Definition at line 86 of file XrdStatistics.cc.

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

86  {
87  return m_instance.load(std::memory_order_relaxed);
88 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:66
std::shared_ptr< XrdSiteStatistics > XrdSiteStatisticsInformation::getStatisticsForSite ( std::string const &  site)

Definition at line 65 of file XrdStatistics.cc.

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

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 }
std::vector< edm::propagate_const< std::shared_ptr< XrdSiteStatistics > > > m_sites
Definition: XrdStatistics.h:68
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 56 of file XrdStatistics.h.

Member Data Documentation

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

Definition at line 66 of file XrdStatistics.h.

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

Definition at line 67 of file XrdStatistics.h.

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

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