CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Static Public Member Functions | Static Private Attributes
StorageAccount Class Reference

#include <StorageAccount.h>

Classes

struct  Counter
 
class  Stamp
 
class  StorageClassToken
 

Public Types

enum  Operation {
  Operation::check, Operation::close, Operation::construct, Operation::destruct,
  Operation::flush, Operation::open, Operation::position, Operation::prefetch,
  Operation::read, Operation::readActual, Operation::readAsync, Operation::readPrefetchToCache,
  Operation::readViaCache, Operation::readv, Operation::resize, Operation::seek,
  Operation::stagein, Operation::stat, Operation::write, Operation::writeActual,
  Operation::writeViaCache, Operation::writev
}
 
typedef
tbb::concurrent_unordered_map
< int, Counter
OperationStats
 
typedef
tbb::concurrent_unordered_map
< int, OperationStats
StorageStats
 

Static Public Member Functions

static Countercounter (StorageClassToken token, Operation operation)
 
static void fillSummary (std::map< std::string, std::string > &summary)
 
static const std::string & nameForToken (StorageClassToken)
 
static char const * operationName (Operation operation)
 
static const StorageStatssummary (void)
 
static std::string summaryText (bool banner=false)
 
static StorageClassToken tokenForStorageClassName (std::string const &iName)
 

Static Private Attributes

static StorageStats m_stats
 

Detailed Description

Definition at line 12 of file StorageAccount.h.

Member Typedef Documentation

typedef tbb::concurrent_unordered_map<int, Counter> StorageAccount::OperationStats

Definition at line 120 of file StorageAccount.h.

typedef tbb::concurrent_unordered_map<int, OperationStats > StorageAccount::StorageStats

Definition at line 121 of file StorageAccount.h.

Member Enumeration Documentation

Enumerator
check 
close 
construct 
destruct 
flush 
open 
position 
prefetch 
read 
readActual 
readAsync 
readPrefetchToCache 
readViaCache 
readv 
resize 
seek 
stagein 
stat 
write 
writeActual 
writeViaCache 
writev 

Definition at line 15 of file StorageAccount.h.

15  {
16  check,
17  close,
18  construct,
19  destruct,
20  flush,
21  open,
22  position,
23  prefetch,
24  read,
25  readActual,
26  readAsync,
27  readPrefetchToCache,
28  readViaCache,
29  readv,
30  resize,
31  seek,
32  stagein,
33  stat,
34  write,
35  writeActual,
36  writeViaCache,
37  writev
38  };
static int position[264][3]
Definition: ReadPGInfo.cc:509

Member Function Documentation

StorageAccount::Counter & StorageAccount::counter ( StorageClassToken  token,
Operation  operation 
)
static
void StorageAccount::fillSummary ( std::map< std::string, std::string > &  summary)
static

Definition at line 103 of file StorageAccount.cc.

References d2str(), i, i2str(), j, and m_stats.

Referenced by TFileAdaptor::statsXML().

103  {
104  int const oneM = 1000 * 1000;
105  int const oneMeg = 1024 * 1024;
106  for (auto i = s_nameToToken.begin (); i != s_nameToToken.end(); ++i) {
107  auto const& opStats = m_stats[i->second];
108  for (auto j = opStats.begin(); j != opStats.end(); ++j) {
109  std::ostringstream os;
110  os << "Timing-" << i->first << "-" << kOperationNames[j->first] << "-";
111  summary.insert(std::make_pair(os.str() + "numOperations", i2str(j->second.attempts)));
112  summary.insert(std::make_pair(os.str() + "numSuccessfulOperations", i2str(j->second.successes)));
113  summary.insert(std::make_pair(os.str() + "totalMegabytes", d2str(static_cast<double>(j->second.amount) / oneMeg)));
114  summary.insert(std::make_pair(os.str() + "totalMsecs", d2str(static_cast<double>(j->second.timeTotal) / oneM)));
115  summary.insert(std::make_pair(os.str() + "minMsecs", d2str(static_cast<double>(j->second.timeMin) / oneM)));
116  summary.insert(std::make_pair(os.str() + "maxMsecs", d2str(static_cast<double>(j->second.timeMax) / oneM)));
117  }
118  }
119 }
int i
Definition: DBlmapReader.cc:9
static StorageStats m_stats
static const StorageStats & summary(void)
static std::string d2str(double d)
int j
Definition: DBlmapReader.cc:9
static std::string i2str(int i)
const std::string & StorageAccount::nameForToken ( StorageClassToken  iToken)
static

Definition at line 70 of file StorageAccount.cc.

References assert(), and StorageAccount::StorageClassToken::value().

70  {
71  for( auto it = s_nameToToken.begin(), itEnd = s_nameToToken.end(); it != itEnd; ++it) {
72  if (it->second == iToken.value()) {
73  return it->first;
74  }
75  }
76  assert(false);
77 }
assert(m_qm.get())
char const * StorageAccount::operationName ( Operation  operation)
inlinestatic

Definition at line 53 of file StorageAccount.cc.

53  {
54  return kOperationNames[static_cast<int>(operation)];
55 }
const StorageAccount::StorageStats & StorageAccount::summary ( void  )
static
std::string StorageAccount::summaryText ( bool  banner = false)
static

Definition at line 81 of file StorageAccount.cc.

References plotBeamSpotDB::first, i, j, and m_stats.

Referenced by TFileAdaptor::stats().

81  {
82  bool first = true;
83  std::ostringstream os;
84  if (banner)
85  os << "stats: class/operation/attempts/successes/amount/time-total/time-min/time-max\n";
86  for (auto i = s_nameToToken.begin (); i != s_nameToToken.end(); ++i) {
87  auto const& opStats = m_stats[i->second];
88  for (auto j = opStats.begin (); j != opStats.end (); ++j, first = false)
89  os << (first ? "" : "; ")
90  << (i->first) << '/'
91  << kOperationNames[j->first] << '='
92  << j->second.attempts << '/'
93  << j->second.successes << '/'
94  << (static_cast<double>(j->second.amount) / 1024 / 1024) << "MB/"
95  << (static_cast<double>(j->second.timeTotal) / 1000 / 1000) << "ms/"
96  << (static_cast<double>(j->second.timeMin) / 1000 / 1000) << "ms/"
97  << (static_cast<double>(j->second.timeMax) / 1000 / 1000) << "ms";
98  }
99  return os.str ();
100 }
int i
Definition: DBlmapReader.cc:9
static StorageStats m_stats
int j
Definition: DBlmapReader.cc:9
StorageAccount::StorageClassToken StorageAccount::tokenForStorageClassName ( std::string const &  iName)
static

Definition at line 57 of file StorageAccount.cc.

References runTheMatrix::ret, and relativeConstraints::value.

Referenced by StorageFactory::check(), edm::storage::StatisticsSenderService::FileStatistics::fillUDP(), StorageFactory::open(), StorageFactory::stagein(), storageCounter(), and edm::service::CondorStatusService::updateImpl().

57  {
58  auto itFound = s_nameToToken.find(iName);
59  if( itFound != s_nameToToken.end()) {
60  return StorageClassToken(itFound->second);
61  }
62  int value = s_nextTokenValue++;
63 
64  auto ret = s_nameToToken.insert(std::make_pair(iName, value));
65 
66  //don't use value since another thread may have beaten us to here
67  return StorageClassToken(ret.second);
68 }
tuple ret
prodAgent to be discontinued

Member Data Documentation

StorageAccount::StorageStats StorageAccount::m_stats
staticprivate

Definition at line 134 of file StorageAccount.h.

Referenced by counter(), fillSummary(), summary(), and summaryText().