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  };
bool check(const std::string &)
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 102 of file StorageAccount.cc.

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

Referenced by TFileAdaptor::statsXML().

102  {
103  int const oneM = 1000 * 1000;
104  int const oneMeg = 1024 * 1024;
105  for (auto i = s_nameToToken.begin (); i != s_nameToToken.end(); ++i) {
106  auto const& opStats = m_stats[i->second];
107  for (auto j = opStats.begin(); j != opStats.end(); ++j) {
108  std::ostringstream os;
109  os << "Timing-" << i->first << "-" << kOperationNames[j->first] << "-";
110  summary.insert(std::make_pair(os.str() + "numOperations", i2str(j->second.attempts)));
111  summary.insert(std::make_pair(os.str() + "numSuccessfulOperations", i2str(j->second.successes)));
112  summary.insert(std::make_pair(os.str() + "totalMegabytes", d2str(static_cast<double>(j->second.amount) / oneMeg)));
113  summary.insert(std::make_pair(os.str() + "totalMsecs", d2str(static_cast<double>(j->second.timeTotal) / oneM)));
114  summary.insert(std::make_pair(os.str() + "minMsecs", d2str(static_cast<double>(j->second.timeMin) / oneM)));
115  summary.insert(std::make_pair(os.str() + "maxMsecs", d2str(static_cast<double>(j->second.timeMax) / oneM)));
116  }
117  }
118 }
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 69 of file StorageAccount.cc.

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

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

Definition at line 52 of file StorageAccount.cc.

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

Definition at line 80 of file StorageAccount.cc.

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

Referenced by TFileAdaptor::stats().

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

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

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

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

Member Data Documentation

StorageAccount::StorageStats StorageAccount::m_stats
staticprivate

Definition at line 134 of file StorageAccount.h.

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