CMS 3D CMS Logo

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, CounterOperationStats
 
typedef tbb::concurrent_unordered_map< int, OperationStatsStorageStats
 

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

◆ OperationStats

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

Definition at line 118 of file StorageAccount.h.

◆ StorageStats

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

Definition at line 119 of file StorageAccount.h.

Member Enumeration Documentation

◆ Operation

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 14 of file StorageAccount.h.

14  {
15  check,
16  close,
17  construct,
18  destruct,
19  flush,
20  open,
21  position,
22  prefetch,
23  read,
24  readActual,
25  readAsync,
26  readPrefetchToCache,
27  readViaCache,
28  readv,
29  resize,
30  seek,
31  stagein,
32  stat,
33  write,
34  writeActual,
35  writeViaCache,
36  writev
37  };

Member Function Documentation

◆ counter()

StorageAccount::Counter & StorageAccount::counter ( StorageClassToken  token,
Operation  operation 
)
static

◆ fillSummary()

void StorageAccount::fillSummary ( std::map< std::string, std::string > &  summary)
static

Definition at line 76 of file StorageAccount.cc.

76  {
77  int const oneM = 1000 * 1000;
78  int const oneMeg = 1024 * 1024;
79  for (auto i = s_nameToToken.begin(); i != s_nameToToken.end(); ++i) {
80  auto const& opStats = m_stats[i->second];
81  for (auto j = opStats.begin(); j != opStats.end(); ++j) {
82  std::ostringstream os;
83  os << "Timing-" << i->first << "-" << kOperationNames[j->first] << "-";
84  summary.insert(std::make_pair(os.str() + "numOperations", i2str(j->second.attempts)));
85  summary.insert(std::make_pair(os.str() + "numSuccessfulOperations", i2str(j->second.successes)));
86  summary.insert(
87  std::make_pair(os.str() + "totalMegabytes", d2str(static_cast<double>(j->second.amount) / oneMeg)));
88  summary.insert(std::make_pair(os.str() + "totalMsecs", d2str(static_cast<double>(j->second.timeTotal) / oneM)));
89  summary.insert(std::make_pair(os.str() + "minMsecs", d2str(static_cast<double>(j->second.timeMin) / oneM)));
90  summary.insert(std::make_pair(os.str() + "maxMsecs", d2str(static_cast<double>(j->second.timeMax) / oneM)));
91  }
92  }
93 }

References d2str(), mps_fire::i, i2str(), dqmiolumiharvest::j, m_stats, and summary().

Referenced by TFileAdaptor::statsXML().

◆ nameForToken()

const std::string & StorageAccount::nameForToken ( StorageClassToken  iToken)
static

Definition at line 50 of file StorageAccount.cc.

50  {
51  for (auto it = s_nameToToken.begin(), itEnd = s_nameToToken.end(); it != itEnd; ++it) {
52  if (it->second == iToken.value()) {
53  return it->first;
54  }
55  }
56  assert(false);
57 }

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

◆ operationName()

char const * StorageAccount::operationName ( Operation  operation)
inlinestatic

Definition at line 34 of file StorageAccount.cc.

34  {
35  return kOperationNames[static_cast<int>(operation)];
36 }

◆ summary()

const StorageAccount::StorageStats & StorageAccount::summary ( void  )
static

◆ summaryText()

std::string StorageAccount::summaryText ( bool  banner = false)
static

Definition at line 59 of file StorageAccount.cc.

59  {
60  bool first = true;
61  std::ostringstream os;
62  if (banner)
63  os << "stats: class/operation/attempts/successes/amount/time-total/time-min/time-max\n";
64  for (auto i = s_nameToToken.begin(); i != s_nameToToken.end(); ++i) {
65  auto const& opStats = m_stats[i->second];
66  for (auto j = opStats.begin(); j != opStats.end(); ++j, first = false)
67  os << (first ? "" : "; ") << (i->first) << '/' << kOperationNames[j->first] << '=' << j->second.attempts << '/'
68  << j->second.successes << '/' << (static_cast<double>(j->second.amount) / 1024 / 1024) << "MB/"
69  << (static_cast<double>(j->second.timeTotal) / 1000 / 1000) << "ms/"
70  << (static_cast<double>(j->second.timeMin) / 1000 / 1000) << "ms/"
71  << (static_cast<double>(j->second.timeMax) / 1000 / 1000) << "ms";
72  }
73  return os.str();
74 }

References dqmdumpme::first, mps_fire::i, dqmiolumiharvest::j, and m_stats.

Referenced by TFileAdaptor::stats().

◆ tokenForStorageClassName()

StorageAccount::StorageClassToken StorageAccount::tokenForStorageClassName ( std::string const &  iName)
static

Definition at line 38 of file StorageAccount.cc.

38  {
39  auto itFound = s_nameToToken.find(iName);
40  if (itFound != s_nameToToken.end()) {
41  return StorageClassToken(itFound->second);
42  }
43  int value = s_nextTokenValue++;
44 
45  s_nameToToken.insert(std::make_pair(iName, value));
46 
47  return StorageClassToken(value);
48 }

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

Member Data Documentation

◆ m_stats

StorageAccount::StorageStats StorageAccount::m_stats
staticprivate

Definition at line 131 of file StorageAccount.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
cms::cuda::assert
assert(be >=bs)
StorageAccount::m_stats
static StorageStats m_stats
Definition: StorageAccount.h:131
dqmdumpme.first
first
Definition: dqmdumpme.py:55
RPCNoise_example.check
check
Definition: RPCNoise_example.py:71
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1119
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
value
Definition: value.py:1
StorageAccount::summary
static const StorageStats & summary(void)
Definition: StorageAccount.cc:95
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38
i2str
static std::string i2str(int i)
Definition: StorageAccount.cc:22
writeEcalDQMStatus.write
write
Definition: writeEcalDQMStatus.py:48
d2str
static std::string d2str(double d)
Definition: StorageAccount.cc:28
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DDDCmsTrackerContruction::construct
std::unique_ptr< GeometricDet > construct(DDCompactView const &cpv, std::vector< int > const &detidShifts)
Definition: DDDCmsTrackerContruction.cc:18
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318