CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StorageAccountProxy.cc
Go to the documentation of this file.
2 
4  Storage *baseStorage)
5  : m_storageClass (storageClass),
6  m_baseStorage (baseStorage),
7  m_statsRead (StorageAccount::counter (m_storageClass, "read")),
8  m_statsReadV (StorageAccount::counter (m_storageClass, "readv")),
9  m_statsWrite (StorageAccount::counter (m_storageClass, "write")),
10  m_statsWriteV (StorageAccount::counter (m_storageClass, "writev")),
11  m_statsPosition (StorageAccount::counter (m_storageClass, "position")),
12  m_statsPrefetch (StorageAccount::counter (m_storageClass, "prefetch"))
13 {
15  stats.tick ();
16 }
17 
19 {
21  delete m_baseStorage;
22  stats.tick ();
23 }
24 
25 IOSize
27 {
29  IOSize result = m_baseStorage->read (into, n);
30  stats.tick (result);
31  return result;
32 }
33 
34 IOSize
36 {
38  IOSize result = m_baseStorage->read (into, n, pos);
39  stats.tick (result);
40  return result;
41 }
42 
43 IOSize
45 {
47  IOSize result = m_baseStorage->readv (into, n);
48  stats.tick (result, n);
49  return result;
50 }
51 
52 IOSize
54 {
56  IOSize result = m_baseStorage->readv (into, n);
57  stats.tick (result, n);
58  return result;
59 }
60 
61 IOSize
62 StorageAccountProxy::write (const void *from, IOSize n)
63 {
65  IOSize result = m_baseStorage->write (from, n);
66  stats.tick (result);
67  return result;
68 }
69 
70 IOSize
71 StorageAccountProxy::write (const void *from, IOSize n, IOOffset pos)
72 {
74  IOSize result = m_baseStorage->write (from, n, pos);
75  stats.tick (result);
76  return result;
77 }
78 
79 IOSize
81 {
83  IOSize result = m_baseStorage->writev (from, n);
84  stats.tick (result, n);
85  return result;
86 }
87 
88 IOSize
90 {
92  IOSize result = m_baseStorage->writev (from, n);
93  stats.tick (result, n);
94  return result;
95 }
96 
99 {
101  IOOffset result = m_baseStorage->position (offset, whence);
102  stats.tick ();
103  return result;
104 }
105 
106 void
108 {
110  m_baseStorage->resize (size);
111  stats.tick ();
112 }
113 
114 void
116 {
118  m_baseStorage->flush ();
119  stats.tick ();
120 }
121 
122 void
124 {
126  m_baseStorage->close ();
127  stats.tick ();
128 }
129 
130 bool
132 {
134  bool value = m_baseStorage->prefetch(what, n);
135  if (value)
136  {
137  IOSize total = 0;
138  for (IOSize i = 0; i < n; ++i)
139  total += what[i].size();
140  stats.tick (total);
141  }
142  return value;
143 }
virtual IOSize writev(const IOBuffer *from, IOSize n)
int i
Definition: DBlmapReader.cc:9
void tick(double amount=0., int64_t tick=0) const
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
Definition: Storage.cc:31
StorageAccountProxy(const std::string &storageClass, Storage *baseStorage)
virtual IOSize read(void *into, IOSize n, IOOffset pos)
Definition: Storage.cc:17
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
StorageAccount::Counter & m_statsWrite
StorageAccount::Counter & m_statsPosition
virtual void resize(IOOffset size)=0
virtual void close(void)
Relative
Definition: Storage.h:23
StorageAccount::Counter & m_statsRead
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
virtual IOSize readv(IOBuffer *into, IOSize n)
StorageAccount::Counter & m_statsWriteV
StorageAccount::Counter & m_statsPrefetch
virtual void close(void)
Definition: Storage.cc:128
virtual IOOffset position(void) const
Definition: Storage.cc:95
tuple result
Definition: query.py:137
virtual void flush(void)
Definition: Storage.cc:124
virtual IOSize write(const void *from, IOSize n)
int read(void)
Definition: IOInput.cc:54
unsigned int offset(bool)
virtual void resize(IOOffset size)
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
Definition: Storage.cc:119
virtual void flush(void)
static Counter & counter(const std::string &storageClass, const std::string &operation)
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
static std::atomic< unsigned int > counter
size_t IOSize
Definition: IOTypes.h:14
StorageAccount::Counter & m_statsReadV
tuple size
Write out results.
virtual IOSize writev(const IOPosBuffer *from, IOSize buffers)
Definition: Storage.cc:74