XRootD
XrdStatsDirectory.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "XrdOuc/XrdOucEnv.hh"
5 #include "XrdOss/XrdOss.hh"
6 #include "XrdStatsFileSystem.hh"
7 #include "XrdSys/XrdSysError.hh"
8 
9 #include <memory>
10 
11 class StatsDirectory : public XrdOssDF {
12 public:
13  StatsDirectory(const char *user, std::unique_ptr<XrdOssDF> ossDF, XrdSysError &log, StatsFileSystem &oss) :
14  XrdOssDF(user),
15  m_wrappedDir(std::move(ossDF)),
16  m_log(log),
17  m_oss(oss)
18  {
19  }
20 
21  virtual ~StatsDirectory() {}
22 
23  virtual int
24  Opendir(const char *path,
25  XrdOucEnv &env) override
26  {
27  StatsFileSystem::OpTimer op(m_oss.m_ops.m_dirlist_ops, m_oss.m_slow_ops.m_dirlist_ops, m_oss.m_times.m_dirlist, m_oss.m_slow_times.m_dirlist, m_oss.m_slow_duration);
28  return m_wrappedDir->Opendir(path, env);
29  }
30 
31  int Readdir(char *buff, int blen) override
32  {
33  StatsFileSystem::OpTimer op(m_oss.m_ops.m_dirlist_entries, m_oss.m_slow_ops.m_dirlist_entries, m_oss.m_times.m_dirlist, m_oss.m_slow_times.m_dirlist, m_oss.m_slow_duration);
34  return m_wrappedDir->Readdir(buff, blen);
35  }
36 
37  int StatRet(struct stat *statStruct) override
38  {
39  return m_wrappedDir->StatRet(statStruct);
40  }
41 
42  int Close(long long *retsz=0) override
43  {
44  return m_wrappedDir->Close(retsz);
45  }
46 
47 
48 private:
49  std::unique_ptr<XrdOssDF> m_wrappedDir;
50  XrdSysError m_log;
51  StatsFileSystem &m_oss;
52 };
int stat(const char *path, struct stat *buf)
int Readdir(char *buff, int blen) override
virtual ~StatsDirectory()
int StatRet(struct stat *statStruct) override
int Close(long long *retsz=0) override
virtual int Opendir(const char *path, XrdOucEnv &env) override
StatsDirectory(const char *user, std::unique_ptr< XrdOssDF > ossDF, XrdSysError &log, StatsFileSystem &oss)