CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
StatisticsSenderService.h
Go to the documentation of this file.
1 
2 #ifndef Utilities_StorageFactory_StatisticsSenderService_H
3 #define Utilities_StorageFactory_StatisticsSenderService_H
4 
5 #include <string>
6 #include <sstream>
7 #include <atomic>
8 #include <mutex>
9 #include <tbb/concurrent_unordered_map.h>
11 
12 namespace edm {
13 
14  class ParameterSet;
15  class ActivityRegistry;
16 
17  namespace storage {
18 
20  public:
22 
23  void setSize(const std::string& urlOrLfn, size_t size);
24  void setCurrentServer(const std::string& urlOrLfn, const std::string& servername);
25  static const char* getJobID();
26  static bool getX509Subject(std::string&);
27 
28  void openingFile(std::string const& lfn, edm::InputType type, size_t size = -1);
29  void closedFile(std::string const& lfn, bool usedFallback);
30 
31  private:
32  void filePostCloseEvent(std::string const& lfn, bool usedFallback);
33 
34  std::string const* matchedLfn(std::string const& iURL); //updates its internal cache
36  public:
38  void fillUDP(std::ostringstream& os) const;
39  void update();
40 
41  private:
50  time_t m_start_time;
51  };
52 
53  struct FileInfo {
54  explicit FileInfo(std::string const& iLFN, edm::InputType);
55 
56  FileInfo(FileInfo&& iInfo)
57  : m_filelfn(std::move(iInfo.m_filelfn)),
58  m_serverhost(std::move(iInfo.m_serverhost)),
59  m_serverdomain(std::move(iInfo.m_serverdomain)),
60  m_type(iInfo.m_type),
61  m_size(iInfo.m_size.load()),
62  m_id(iInfo.m_id),
63  m_openCount(iInfo.m_openCount.load()) {}
68  std::atomic<ssize_t> m_size;
69  size_t m_id; //from m_counter
70  std::atomic<int> m_openCount;
71  };
72 
73  void determineHostnames();
74  void fillUDP(const std::string& site, const FileInfo& fileinfo, bool, std::string&) const;
75  void cleanupOldFiles();
76 
79  tbb::concurrent_unordered_map<std::string, FileInfo> m_lfnToFileInfo;
80  tbb::concurrent_unordered_map<std::string, std::string> m_urlToLfn;
83  size_t m_counter;
86  const bool m_debug;
87  };
88 
89  } // namespace storage
90 } // namespace edm
91 
92 #endif
InputType
Definition: InputType.h:5
void setSize(const std::string &urlOrLfn, size_t size)
static std::mutex mutex
Definition: Proxy.cc:8
void fillUDP(const std::string &site, const FileInfo &fileinfo, bool, std::string &) const
tbb::concurrent_unordered_map< std::string, std::string > m_urlToLfn
std::string const * matchedLfn(std::string const &iURL)
def move
Definition: eostools.py:511
def load
Definition: svgfig.py:547
void openingFile(std::string const &lfn, edm::InputType type, size_t size=-1)
void setCurrentServer(const std::string &urlOrLfn, const std::string &servername)
tbb::concurrent_unordered_map< std::string, FileInfo > m_lfnToFileInfo
void closedFile(std::string const &lfn, bool usedFallback)
FileInfo(std::string const &iLFN, edm::InputType)
StatisticsSenderService(edm::ParameterSet const &pset, edm::ActivityRegistry &ar)
tuple size
Write out results.
void filePostCloseEvent(std::string const &lfn, bool usedFallback)