CMS 3D CMS Logo

FastMonitor.h
Go to the documentation of this file.
1 /*
2  * FastMonitor.h
3  *
4  * Created on: Nov 27, 2012
5  * Author: aspataru
6  */
7 
8 #ifndef FASTMONITOR_H_
9 #define FASTMONITOR_H_
10 
14 
15 #include <unordered_set>
16 
17 namespace jsoncollector {
18 
19  class FastMonitor {
20  public:
21  FastMonitor(std::string const& defPath,
22  std::string const defGroup,
23  bool strictChecking,
24  bool useSource = true,
25  bool useDefinition = true);
26  FastMonitor(DataPointDefinition* dpd, bool strictChecking, bool useSource = true, bool useDefinition = true);
27 
28  virtual ~FastMonitor();
29 
30  void addFastPathDefinition(std::string const& defPathFast, std::string const defGroupFast, bool strict);
31 
32  void setDefPath(std::string const& dpath) {
33  defPath_ = dpath;
34  for (auto dp : dataPoints_)
35  dp->updateDefinition(dpath);
36  }
37 
38  void setNStreams(unsigned int nStreams) { nStreams_ = nStreams; }
39 
40  //register global monitorable
41  void registerGlobalMonitorable(JsonMonitorable* newMonitorable,
42  bool NAifZeroUpdates,
43  unsigned int* nBins = nullptr);
44 
45  //register fastPath global monitorable
46  void registerFastGlobalMonitorable(JsonMonitorable* newMonitorable);
47 
48  //register per-stream monitores vector (unsigned int)
50  std::vector<unsigned int>* inputs,
51  bool NAifZeroUpdates,
52  unsigned int* nBins = nullptr);
53 
54  //NOT implemented yet
55  //void registerStreamMonitorableIntVec(std::string &name, std::vector<unsigned int>,true,0);
56  //void registerStreamMonitorableDoubleVec(std::string &name, std::vector<unsigned int>,true,0);
57  //void registerStreamMonitorableStringVec(std::string &name, std::vector<std::string>,true,0);
58 
60  std::vector<AtomicMonUInt*>* inputs,
61  bool NAifZeroUpdates,
62  unsigned int* nBins = nullptr);
63 
64  //take vector used to track stream lumis and finish initialization
65  void commit(std::vector<unsigned int>* streamLumisPtr);
66 
67  // fetches new snapshot and outputs one-line CSV if set (timer based)
68  void snap(unsigned int ls);
69 
70  //only update global variables (invoked at global EOL)
71  void snapGlobal(unsigned int ls);
72 
73  //only updates atomic vectors (for certain stream - at stream EOL)
74  void snapStreamAtomic(unsigned int ls, unsigned int streamID);
75 
76  //fastpath CSV string
77  std::string getCSVString(int sid = -1);
78 
79  //fastpath file output
80  void outputCSV(std::string const& path, std::string const& csvString);
81 
82  //provide merged variable back to user
83  JsonMonitorable* getMergedIntJForLumi(std::string const& name, unsigned int forLumi);
84 
85  // merges and outputs everything collected for the given stream to JSON file
86  bool outputFullJSONs(std::string const& pathstem, std::string const& ext, unsigned int lumi);
87  bool outputFullJSON(std::string const& path, unsigned int lumi);
88 
89  //discard what was collected for a lumisection
90  void discardCollected(unsigned int forLumi);
91 
92  //this is added to the JSON file
93  void getHostAndPID(std::string& sHPid);
94 
95  private:
102  bool haveFastPath_ = false;
103 
104  unsigned int nStreams_;
105 
109  bool deleteDef_ = false;
110  bool deleteDefFast_ = false;
111 
112  std::vector<DataPoint*> dataPoints_;
113  std::vector<DataPoint*> dataPointsFastOnly_;
114  std::vector<unsigned int> jsonDpIndex_;
115  std::vector<DataPoint*> jsonDpIndexFast_;
116  std::vector<DataPoint*> orphanedDps_;
117  std::map<std::string, unsigned int> dpNameMap_;
118 
119  unsigned int recentSnaps_ = 0;
120  unsigned int recentSnapsTimer_ = 0;
121  unsigned int regDpCount_ = 0;
122  unsigned int fregDpCount_ = 0;
123 
124  std::unordered_set<std::string> uids_;
125  };
126 
127 } // namespace jsoncollector
128 
129 #endif /* FASTMONITOR_H_ */
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
ext
Definition: memstream.h:15
jsoncollector::FastMonitor::uids_
std::unordered_set< std::string > uids_
Definition: FastMonitor.h:124
DataPoint.h
jsoncollector::FastMonitor::useSource_
bool useSource_
Definition: FastMonitor.h:100
jsoncollector::FastMonitor::setNStreams
void setNStreams(unsigned int nStreams)
Definition: FastMonitor.h:38
jsoncollector::FastMonitor::recentSnapsTimer_
unsigned int recentSnapsTimer_
Definition: FastMonitor.h:120
jsoncollector::FastMonitor::dataPoints_
std::vector< DataPoint * > dataPoints_
Definition: FastMonitor.h:112
jsoncollector::FastMonitor::commit
void commit(std::vector< unsigned int > *streamLumisPtr)
Definition: FastMonitor.cc:115
jsoncollector::FastMonitor::deleteDefFast_
bool deleteDefFast_
Definition: FastMonitor.h:110
jsoncollector::FastMonitor::getMergedIntJForLumi
JsonMonitorable * getMergedIntJForLumi(std::string const &name, unsigned int forLumi)
Definition: FastMonitor.cc:236
JsonMonitorable.h
jsoncollector::FastMonitor::recentSnaps_
unsigned int recentSnaps_
Definition: FastMonitor.h:119
jsoncollector::FastMonitor::sourceInfo_
std::string sourceInfo_
Definition: FastMonitor.h:106
jsoncollector::FastMonitor::getHostAndPID
void getHostAndPID(std::string &sHPid)
Definition: FastMonitor.cc:285
jsoncollector::FastMonitor::jsonDpIndexFast_
std::vector< DataPoint * > jsonDpIndexFast_
Definition: FastMonitor.h:115
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:362
jsoncollector::FastMonitor::registerGlobalMonitorable
void registerGlobalMonitorable(JsonMonitorable *newMonitorable, bool NAifZeroUpdates, unsigned int *nBins=nullptr)
Definition: FastMonitor.cc:66
jsoncollector::FastMonitor::dpdFast_
DataPointDefinition * dpdFast_
Definition: FastMonitor.h:108
jsoncollector::FastMonitor::fregDpCount_
unsigned int fregDpCount_
Definition: FastMonitor.h:122
jsoncollector::FastMonitor::registerStreamMonitorableUIntVec
void registerStreamMonitorableUIntVec(std::string const &name, std::vector< unsigned int > *inputs, bool NAifZeroUpdates, unsigned int *nBins=nullptr)
Definition: FastMonitor.cc:87
jsoncollector::FastMonitor::setDefPath
void setDefPath(std::string const &dpath)
Definition: FastMonitor.h:32
jsoncollector::FastMonitor::outputFullJSONs
bool outputFullJSONs(std::string const &pathstem, std::string const &ext, unsigned int lumi)
Definition: FastMonitor.cc:242
jsoncollector::FastMonitor::nStreams_
unsigned int nStreams_
Definition: FastMonitor.h:104
jsoncollector::FastMonitor::addFastPathDefinition
void addFastPathDefinition(std::string const &defPathFast, std::string const defGroupFast, bool strict)
Definition: FastMonitor.cc:56
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:157
jsoncollector::FastMonitor::defPath_
std::string defPath_
Definition: FastMonitor.h:96
jsoncollector::FastMonitor::outputCSV
void outputCSV(std::string const &path, std::string const &csvString)
Definition: FastMonitor.cc:227
jsoncollector::FastMonitor::deleteDef_
bool deleteDef_
Definition: FastMonitor.h:109
seedmultiplicitymonitor_newtracking_cfi.nBins
nBins
Definition: seedmultiplicitymonitor_newtracking_cfi.py:8
jsoncollector::FastMonitor::haveFastPath_
bool haveFastPath_
Definition: FastMonitor.h:102
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
jsoncollector::FastMonitor::snapGlobal
void snapGlobal(unsigned int ls)
Definition: FastMonitor.cc:198
jsoncollector::FastMonitor::fastPathStrictChecking_
bool fastPathStrictChecking_
Definition: FastMonitor.h:99
jsoncollector::FastMonitor::regDpCount_
unsigned int regDpCount_
Definition: FastMonitor.h:121
jsoncollector::FastMonitor::registerStreamMonitorableUIntVecAtomic
void registerStreamMonitorableUIntVecAtomic(std::string const &name, std::vector< AtomicMonUInt * > *inputs, bool NAifZeroUpdates, unsigned int *nBins=nullptr)
Definition: FastMonitor.cc:100
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
jsoncollector::FastMonitor::~FastMonitor
virtual ~FastMonitor()
Definition: FastMonitor.cc:47
jsoncollector::FastMonitor::registerFastGlobalMonitorable
void registerFastGlobalMonitorable(JsonMonitorable *newMonitorable)
Definition: FastMonitor.cc:80
jsoncollector::FastMonitor::useDefinition_
bool useDefinition_
Definition: FastMonitor.h:101
jsoncollector::FastMonitor::orphanedDps_
std::vector< DataPoint * > orphanedDps_
Definition: FastMonitor.h:116
jsoncollector::FastMonitor::dpd_
DataPointDefinition * dpd_
Definition: FastMonitor.h:107
jsoncollector::FastMonitor
Definition: FastMonitor.h:19
jsoncollector::JsonMonitorable
Definition: JsonMonitorable.h:24
jsoncollector
Definition: DataPoint.h:26
jsoncollector::DataPointDefinition
Definition: DataPointDefinition.h:20
DataPointDefinition.h
jsoncollector::FastMonitor::outputFullJSON
bool outputFullJSON(std::string const &path, unsigned int lumi)
Definition: FastMonitor.cc:264
jsoncollector::FastMonitor::snapStreamAtomic
void snapStreamAtomic(unsigned int ls, unsigned int streamID)
Definition: FastMonitor.cc:206
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
jsoncollector::FastMonitor::dpNameMap_
std::map< std::string, unsigned int > dpNameMap_
Definition: FastMonitor.h:117
jsoncollector::FastMonitor::snap
void snap(unsigned int ls)
Definition: FastMonitor.cc:189
jsoncollector::FastMonitor::strictChecking_
bool strictChecking_
Definition: FastMonitor.h:98
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
jsoncollector::FastMonitor::FastMonitor
FastMonitor(std::string const &defPath, std::string const defGroup, bool strictChecking, bool useSource=true, bool useDefinition=true)
Definition: FastMonitor.cc:23
jsoncollector::FastMonitor::getCSVString
std::string getCSVString(int sid=-1)
Definition: FastMonitor.cc:213
jsoncollector::FastMonitor::jsonDpIndex_
std::vector< unsigned int > jsonDpIndex_
Definition: FastMonitor.h:114
jsoncollector::FastMonitor::discardCollected
void discardCollected(unsigned int forLumi)
Definition: FastMonitor.cc:280
lumi
Definition: LumiSectionData.h:20
jsoncollector::FastMonitor::defPathFast_
std::string defPathFast_
Definition: FastMonitor.h:97
jsoncollector::FastMonitor::dataPointsFastOnly_
std::vector< DataPoint * > dataPointsFastOnly_
Definition: FastMonitor.h:113