XRootD
StatsFile Class Reference

#include <XrdOssStatsFile.hh>

+ Inheritance diagram for StatsFile:
+ Collaboration diagram for StatsFile:

Public Member Functions

 StatsFile (std::unique_ptr< XrdOssDF > wrapDF, XrdSysError &log, StatsFileSystem &oss)
 
virtual ~StatsFile ()
 
int Fchmod (mode_t mode) override
 
int Fstat (struct stat *buf) override
 
int Ftruncate (unsigned long long size) override
 
int Open (const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) override
 
ssize_t pgRead (void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts) override
 
int pgRead (XrdSfsAio *aioparm, uint64_t opts) override
 
ssize_t pgWrite (void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts) override
 
int pgWrite (XrdSfsAio *aioparm, uint64_t opts) override
 
ssize_t Read (off_t offset, size_t size) override
 
ssize_t Read (void *buffer, off_t offset, size_t size) override
 
int Read (XrdSfsAio *aiop) override
 
ssize_t ReadRaw (void *buffer, off_t offset, size_t size) override
 
ssize_t ReadV (XrdOucIOVec *readV, int rdvcnt) override
 
ssize_t Write (const void *buffer, off_t offset, size_t size) override
 
int Write (XrdSfsAio *aiop) override
 
ssize_t WriteV (XrdOucIOVec *writeV, int wrvcnt) override
 
- Public Member Functions inherited from XrdOssWrapDF
 XrdOssWrapDF (XrdOssDF &df2Wrap)
 
virtual ~XrdOssWrapDF ()
 
virtual int Close (long long *retsz=0)
 
uint16_t DFType ()
 
virtual int Fctl (int cmd, int alen, const char *args, char **resp=0)
 
virtual void Flush ()
 Flush filesystem cached pages for this file (used for checksums). More...
 
virtual int Fsync ()
 
virtual int Fsync (XrdSfsAio *aiop)
 
virtual int getFD ()
 
virtual off_t getMmap (void **addr)
 
virtual const char * getTID ()
 
virtual int isCompressed (char *cxidp=0)
 
virtual int Opendir (const char *path, XrdOucEnv &env)
 
virtual int Readdir (char *buff, int blen)
 
virtual int StatRet (struct stat *Stat)
 
- Public Member Functions inherited from XrdOssDF
 XrdOssDF (const char *tid="", uint16_t dftype=0, int fdnum=-1)
 
virtual ~XrdOssDF ()
 
uint16_t DFType ()
 

Additional Inherited Members

- Static Public Attributes inherited from XrdOssDF
static const uint16_t DF_isDir = 0x0001
 Object is for a directory. More...
 
static const uint16_t DF_isFile = 0x0002
 Object is for a file. More...
 
static const uint16_t DF_isProxy = 0x0010
 Object is a proxy object. More...
 
static const uint64_t doCalc = 0x4000000000000000ULL
 pgw: Calculate checksums More...
 
static const int Fctl_ckpObj = 0
 
static const int Fctl_utimes = 1
 
static const uint64_t Verify = 0x8000000000000000ULL
 all: Verify checksums More...
 
- Protected Attributes inherited from XrdOssWrapDF
XrdOssDFwrapDF
 
- Protected Attributes inherited from XrdOssDF
uint16_t dfType
 
int fd
 
off_t pgwEOF
 
short rsvd
 
const char * tident
 

Detailed Description

Definition at line 13 of file XrdOssStatsFile.hh.

Constructor & Destructor Documentation

◆ StatsFile()

StatsFile::StatsFile ( std::unique_ptr< XrdOssDF wrapDF,
XrdSysError log,
StatsFileSystem oss 
)
inline

Definition at line 15 of file XrdOssStatsFile.hh.

15  :
17  m_wrapped(std::move(wrapDF)),
18  m_log(log),
19  m_oss(oss)
20  {}
XrdOssDF & wrapDF
XrdOssWrapDF(XrdOssDF &df2Wrap)

◆ ~StatsFile()

StatsFile::~StatsFile ( )
virtual

Definition at line 4 of file XrdOssStatsFile.cc.

4 {}

Member Function Documentation

◆ Fchmod()

int StatsFile::Fchmod ( mode_t  mode)
inlineoverridevirtual

Change file mode settings.

Parameters
mode- The new file mode setting.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 30 of file XrdOssStatsFile.hh.

31  {
32  StatsFileSystem::OpTimer op(m_oss.m_ops.m_chmod_ops, m_oss.m_slow_ops.m_chmod_ops, m_oss.m_times.m_chmod, m_oss.m_slow_times.m_chmod, m_oss.m_slow_duration);
33  return wrapDF.Fchmod(mode);
34  }
virtual int Fchmod(mode_t mode)
Definition: XrdOss.hh:120

References XrdOssDF::Fchmod(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Fstat()

int StatsFile::Fstat ( struct stat buf)
inlineoverridevirtual

Return state information for this file.

Parameters
buf- Pointer to the structure where info it to be returned.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 36 of file XrdOssStatsFile.hh.

37  {
38  StatsFileSystem::OpTimer op(m_oss.m_ops.m_stat_ops, m_oss.m_slow_ops.m_stat_ops, m_oss.m_times.m_stat, m_oss.m_slow_times.m_stat, m_oss.m_slow_duration);
39  return wrapDF.Fstat(buf);
40  }
virtual int Fstat(struct stat *buf)
Definition: XrdOss.hh:136

References XrdOssDF::Fstat(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Ftruncate()

int StatsFile::Ftruncate ( unsigned long long  flen)
inlineoverridevirtual

Set the size of the associated file.

Parameters
flen- The new size of the file.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 42 of file XrdOssStatsFile.hh.

43  {
44  StatsFileSystem::OpTimer op(m_oss.m_ops.m_truncate_ops, m_oss.m_slow_ops.m_truncate_ops, m_oss.m_times.m_truncate, m_oss.m_slow_times.m_truncate, m_oss.m_slow_duration);
45  return wrapDF.Ftruncate(size);
46  }
virtual int Ftruncate(unsigned long long flen)
Definition: XrdOss.hh:164

References XrdOssDF::Ftruncate(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Open()

int StatsFile::Open ( const char *  path,
int  Oflag,
mode_t  Mode,
XrdOucEnv env 
)
inlineoverridevirtual

Open a file.

Parameters
path- Pointer to the path of the file to be opened.
Oflag- Standard open flags.
Mode- File open mode (ignored unless creating a file).
env- Reference to environmental information.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 24 of file XrdOssStatsFile.hh.

25  {
26  StatsFileSystem::OpTimer op(m_oss.m_ops.m_open_ops, m_oss.m_slow_ops.m_open_ops, m_oss.m_times.m_open, m_oss.m_slow_times.m_open, m_oss.m_slow_duration);
27  return wrapDF.Open(path, Oflag, Mode, env);
28  }
int Mode
virtual int Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env)
Definition: XrdOss.hh:200

References Mode, XrdOssDF::Open(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ pgRead() [1/2]

ssize_t StatsFile::pgRead ( void *  buffer,
off_t  offset,
size_t  rdlen,
uint32_t *  csvec,
uint64_t  opts 
)
inlineoverridevirtual

Read file pages into a buffer and return corresponding checksums.

Parameters
buffer- pointer to buffer where the bytes are to be placed.
offset- The offset where the read is to start. It must be page aligned.
rdlen- The number of bytes to read. The amount must be an integral number of XrdSfsPage::Size bytes.
csvec- A vector of entries to be filled with the cooresponding CRC32C checksum for each page. It must be size to rdlen/XrdSys::PageSize + (rdlenXrdSys::PageSize != 0)
opts- Processing options (see below).
Returns
>= 0 The number of bytes that placed in buffer upon success.
< 0 -errno or -osserr upon failure. (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 48 of file XrdOssStatsFile.hh.

50  {
51  StatsFileSystem::OpTimer op(m_oss.m_ops.m_pgread_ops, m_oss.m_slow_ops.m_pgread_ops, m_oss.m_times.m_pgread, m_oss.m_slow_times.m_pgread, m_oss.m_slow_duration);
52  return wrapDF.pgRead(buffer, offset, rdlen, csvec, opts);
53  }
struct myOpts opts
virtual ssize_t pgRead(void *buffer, off_t offset, size_t rdlen, uint32_t *csvec, uint64_t opts)
Definition: XrdOss.cc:160

References opts, XrdOssDF::pgRead(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ pgRead() [2/2]

int StatsFile::pgRead ( XrdSfsAio aioparm,
uint64_t  opts 
)
inlineoverridevirtual

Read file pages and checksums using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
opts- Processing options (see above).
Returns
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 55 of file XrdOssStatsFile.hh.

56  {
57  StatsFileSystem::OpTimer op(m_oss.m_ops.m_pgread_ops, m_oss.m_slow_ops.m_pgread_ops, m_oss.m_times.m_pgread, m_oss.m_slow_times.m_pgread, m_oss.m_slow_duration);
58  return wrapDF.pgRead(aioparm, opts);
59  }

References opts, XrdOssDF::pgRead(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ pgWrite() [1/2]

ssize_t StatsFile::pgWrite ( void *  buffer,
off_t  offset,
size_t  wrlen,
uint32_t *  csvec,
uint64_t  opts 
)
inlineoverridevirtual

Write file pages into a file with corresponding checksums.

Parameters
buffer- pointer to buffer containing the bytes to write.
offset- The offset where the write is to start. It must be page aligned.
wrlen- The number of bytes to write. If amount is not an integral number of XrdSys::PageSize bytes, then this must be the last write to the file at or above the offset.
csvec- A vector which contains the corresponding CRC32 checksum for each page. It must be size to wrlen/XrdSys::PageSize + (wrlenXrdSys::PageSize != 0)
opts- Processing options (see above).
Returns
>= 0 The number of bytes written upon success. or -errno or -osserr upon failure. (see XrdOssError.hh).
< 0 -errno or -osserr upon failure. (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 61 of file XrdOssStatsFile.hh.

63  {
64  StatsFileSystem::OpTimer op(m_oss.m_ops.m_pgwrite_ops, m_oss.m_slow_ops.m_pgwrite_ops, m_oss.m_times.m_pgwrite, m_oss.m_slow_times.m_pgwrite, m_oss.m_slow_duration);
65  return wrapDF.pgWrite(buffer, offset, wrlen, csvec, opts);
66  }
virtual ssize_t pgWrite(void *buffer, off_t offset, size_t wrlen, uint32_t *csvec, uint64_t opts)
Definition: XrdOss.cc:198

References opts, XrdOssDF::pgWrite(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ pgWrite() [2/2]

int StatsFile::pgWrite ( XrdSfsAio aioparm,
uint64_t  opts 
)
inlineoverridevirtual

Write file pages and checksums using asynchronous I/O.

Parameters
aioparm- Pointer to async I/O object controlling the I/O.
opts- Processing options (see above).
Returns
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 68 of file XrdOssStatsFile.hh.

69  {
70  StatsFileSystem::OpTimer op(m_oss.m_ops.m_pgwrite_ops, m_oss.m_slow_ops.m_pgwrite_ops, m_oss.m_times.m_pgwrite, m_oss.m_slow_times.m_pgwrite, m_oss.m_slow_duration);
71  return wrapDF.pgWrite(aioparm, opts);
72  }

References opts, XrdOssDF::pgWrite(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Read() [1/3]

ssize_t StatsFile::Read ( off_t  offset,
size_t  size 
)
inlineoverridevirtual

Preread file blocks into the file system cache.

Parameters
offset- The offset where the read is to start.
size- The number of bytes to pre-read.
Returns
0 upon success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 74 of file XrdOssStatsFile.hh.

75  {
76  StatsFileSystem::OpTimer op(m_oss.m_ops.m_read_ops, m_oss.m_slow_ops.m_read_ops, m_oss.m_times.m_read, m_oss.m_slow_times.m_read, m_oss.m_slow_duration);
77  return wrapDF.Read(offset, size);
78  }
virtual ssize_t Read(off_t offset, size_t size)
Definition: XrdOss.hh:281

References XrdOssDF::Read(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Read() [2/3]

ssize_t StatsFile::Read ( void *  buffer,
off_t  offset,
size_t  size 
)
inlineoverridevirtual

Read file bytes into a buffer.

Parameters
buffer- pointer to buffer where the bytes are to be placed.
offset- The offset where the read is to start.
size- The number of bytes to read.
Returns
>= 0 The number of bytes that placed in buffer.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 80 of file XrdOssStatsFile.hh.

81  {
82  StatsFileSystem::OpTimer op(m_oss.m_ops.m_read_ops, m_oss.m_slow_ops.m_read_ops, m_oss.m_times.m_read, m_oss.m_slow_times.m_read, m_oss.m_slow_duration);
83  return wrapDF.Read(buffer, offset, size);
84  }

References XrdOssDF::Read(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Read() [3/3]

int StatsFile::Read ( XrdSfsAio aiop)
inlineoverridevirtual

Read file bytes using asynchronous I/O.

Parameters
aiop- Pointer to async I/O object controlling the I/O.
Returns
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 86 of file XrdOssStatsFile.hh.

87  {
88  StatsFileSystem::OpTimer op(m_oss.m_ops.m_read_ops, m_oss.m_slow_ops.m_read_ops, m_oss.m_times.m_read, m_oss.m_slow_times.m_read, m_oss.m_slow_duration);
89  return wrapDF.Read(aiop);
90  }

References XrdOssDF::Read(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ ReadRaw()

ssize_t StatsFile::ReadRaw ( void *  buffer,
off_t  offset,
size_t  size 
)
inlineoverridevirtual

Read uncompressed file bytes into a buffer.

Parameters
buffer- pointer to buffer where the bytes are to be placed.
offset- The offset where the read is to start.
size- The number of bytes to read.
Returns
>= 0 The number of bytes that placed in buffer.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 92 of file XrdOssStatsFile.hh.

93  {
94  StatsFileSystem::OpTimer op(m_oss.m_ops.m_read_ops, m_oss.m_slow_ops.m_read_ops, m_oss.m_times.m_read, m_oss.m_slow_times.m_read, m_oss.m_slow_duration);
95  return wrapDF.ReadRaw(buffer, offset, size);
96  }
virtual ssize_t ReadRaw(void *buffer, off_t offset, size_t size)
Definition: XrdOss.hh:319

References XrdOssDF::ReadRaw(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ ReadV()

ssize_t StatsFile::ReadV ( XrdOucIOVec readV,
int  rdvcnt 
)
inlineoverridevirtual

Read file bytes as directed by the read vector.

Parameters
readVpointer to the array of read requests.
rdvcntthe number of elements in readV.
Returns
>=0 The numbe of bytes read.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 98 of file XrdOssStatsFile.hh.

99  {
100  auto start = std::chrono::steady_clock::now();
101  auto result = wrapDF.ReadV(readV, rdvcnt);
102  auto dur = std::chrono::steady_clock::now() - start;
103  m_oss.m_ops.m_readv_ops++;
104  m_oss.m_ops.m_readv_segs += rdvcnt;
105  auto ns = std::chrono::nanoseconds(dur).count();
106  m_oss.m_times.m_readv += ns;
107  if (dur > m_oss.m_slow_duration) {
108  m_oss.m_slow_ops.m_readv_ops++;
109  m_oss.m_slow_ops.m_readv_segs += rdvcnt;
110  m_oss.m_times.m_readv += std::chrono::nanoseconds(dur).count();
111  }
112  return result;
113  }
virtual ssize_t ReadV(XrdOucIOVec *readV, int rdvcnt)
Definition: XrdOss.cc:236

References XrdOssDF::ReadV(), and XrdOssWrapDF::wrapDF.

+ Here is the call graph for this function:

◆ Write() [1/2]

ssize_t StatsFile::Write ( const void *  buffer,
off_t  offset,
size_t  size 
)
inlineoverridevirtual

Write file bytes from a buffer.

Parameters
buffer- pointer to buffer where the bytes reside.
offset- The offset where the write is to start.
size- The number of bytes to write.
Returns
>= 0 The number of bytes that were written.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 115 of file XrdOssStatsFile.hh.

116  {
117  StatsFileSystem::OpTimer op(m_oss.m_ops.m_write_ops, m_oss.m_slow_ops.m_write_ops, m_oss.m_times.m_write, m_oss.m_slow_times.m_write, m_oss.m_slow_duration);
118  return wrapDF.Write(buffer, offset, size);
119  }
virtual ssize_t Write(const void *buffer, off_t offset, size_t size)
Definition: XrdOss.hh:345

References XrdOssWrapDF::wrapDF, and XrdOssDF::Write().

+ Here is the call graph for this function:

◆ Write() [2/2]

int StatsFile::Write ( XrdSfsAio aiop)
inlineoverridevirtual

Write file bytes using asynchronous I/O.

Parameters
aiop- Pointer to async I/O object controlling the I/O.
Returns
0 upon if request started success or -errno or -osserr (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 121 of file XrdOssStatsFile.hh.

122  {
123  StatsFileSystem::OpTimer op(m_oss.m_ops.m_write_ops, m_oss.m_slow_ops.m_write_ops, m_oss.m_times.m_write, m_oss.m_slow_times.m_write, m_oss.m_slow_duration);
124  return wrapDF.Write(aiop);
125  }

References XrdOssWrapDF::wrapDF, and XrdOssDF::Write().

+ Here is the call graph for this function:

◆ WriteV()

ssize_t StatsFile::WriteV ( XrdOucIOVec writeV,
int  wrvcnt 
)
inlineoverridevirtual

Write file bytes as directed by the write vector.

Parameters
writeVpointer to the array of write requests.
wrvcntthe number of elements in writeV.
Returns
>=0 The numbe of bytes read.
< 0 -errno or -osserr upon failure (see XrdOssError.hh).

Reimplemented from XrdOssWrapDF.

Definition at line 127 of file XrdOssStatsFile.hh.

128  {
129  StatsFileSystem::OpTimer op(m_oss.m_ops.m_write_ops, m_oss.m_slow_ops.m_write_ops, m_oss.m_times.m_write, m_oss.m_slow_times.m_write, m_oss.m_slow_duration);
130  return wrapDF.WriteV(writeV, wrvcnt);
131  }
virtual ssize_t WriteV(XrdOucIOVec *writeV, int wrvcnt)
Definition: XrdOss.cc:257

References XrdOssWrapDF::wrapDF, and XrdOssDF::WriteV().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: