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

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
def write(self, setup)
def check(config)
Definition: trackerTree.py:14

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(), mps_fire::i, and i2str().

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 }
static StorageStats m_stats
static const StorageStats & summary(void)
static std::string d2str(double d)
static std::string i2str(int i)
const std::string & StorageAccount::nameForToken ( StorageClassToken  iToken)
static

Definition at line 69 of file StorageAccount.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, 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 }
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 80 of file StorageAccount.cc.

References plotBeamSpotDB::first, and mps_fire::i.

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 }
static StorageStats m_stats
StorageAccount::StorageClassToken StorageAccount::tokenForStorageClassName ( std::string const &  iName)
static

Definition at line 57 of file StorageAccount.cc.

Referenced by StorageFactory::check(), edm::storage::StatisticsSenderService::FileStatistics::fillUDP(), StorageFactory::open(), StorageFactory::stagein(), storageCounter(), edm::storage::StatisticsSenderService::FileStatistics::update(), 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  s_nameToToken.insert(std::make_pair(iName, value));
65 
66  return StorageClassToken(value);
67 }
Definition: value.py:1

Member Data Documentation

StorageAccount::StorageStats StorageAccount::m_stats
staticprivate

Definition at line 134 of file StorageAccount.h.