CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< XrdSiteStatistics
getStatisticsForSite (std::string const &site)
 

Static Public Member Functions

static
XrdSiteStatisticsInformation
getInstance ()
 

Static Private Member Functions

static void createInstance ()
 

Private Attributes

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

Static Private Attributes

static std::atomic
< XrdSiteStatisticsInformation * > 
m_instance
 

Friends

class XrdStatisticsService
 

Detailed Description

Definition at line 44 of file XrdStatistics.h.

Member Function Documentation

void XrdSiteStatisticsInformation::createInstance ( )
staticprivate

Definition at line 62 of file XrdStatistics.cc.

References m_instance, and tmp.

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

63 {
64  if (!m_instance)
65  {
66  std::unique_ptr<XrdSiteStatisticsInformation> tmp { new XrdSiteStatisticsInformation() };
67  XrdSiteStatisticsInformation* expected = nullptr;
68  if (m_instance.compare_exchange_strong(expected,tmp.get()))
69  {
70  tmp.release();
71  }
72  }
73 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:56
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
XrdSiteStatisticsInformation * XrdSiteStatisticsInformation::getInstance ( )
static

Definition at line 76 of file XrdStatistics.cc.

References m_instance.

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

77 {
78  return m_instance.load(std::memory_order_relaxed);
79 }
static std::atomic< XrdSiteStatisticsInformation * > m_instance
Definition: XrdStatistics.h:56
std::shared_ptr< XrdSiteStatistics > XrdSiteStatisticsInformation::getStatisticsForSite ( std::string const &  site)

Definition at line 49 of file XrdStatistics.cc.

References CommonMethods::lock(), m_mutex, and m_sites.

Referenced by if().

50 {
51  std::lock_guard<std::mutex> lock(m_mutex);
52  for (std::shared_ptr<XrdSiteStatistics> &stats : m_sites)
53  {
54  if (stats->site() == site) {return stats;}
55  }
56  m_sites.emplace_back(new XrdSiteStatistics(site));
57  return m_sites.back();
58 }
std::vector< std::shared_ptr< XrdSiteStatistics > > m_sites
Definition: XrdStatistics.h:58

Friends And Related Function Documentation

friend class XrdStatisticsService
friend

Definition at line 46 of file XrdStatistics.h.

Member Data Documentation

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

Definition at line 56 of file XrdStatistics.h.

Referenced by createInstance(), and getInstance().

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

Definition at line 57 of file XrdStatistics.h.

Referenced by getStatisticsForSite().

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