1 #ifndef DQMStoreStats_H 2 #define DQMStoreStats_H 48 void AddBinsF(
unsigned int nBins,
unsigned int nEmptyBins ) { ++
totalHistos_; totalBins_ += nBins; totalEmptyBins_ += nEmptyBins; totalMemory_ += ( nBins *=
sizeof(
float ) ); }
49 void AddBinsS(
unsigned int nBins,
unsigned int nEmptyBins ) { ++
totalHistos_; totalBins_ += nBins; totalEmptyBins_ += nEmptyBins; totalMemory_ += ( nBins *=
sizeof( short ) ); }
50 void AddBinsD(
unsigned int nBins,
unsigned int nEmptyBins ) { ++
totalHistos_; totalBins_ += nBins; totalEmptyBins_ += nEmptyBins; totalMemory_ += ( nBins *=
sizeof( double ) ); }
77 virtual void First() = 0;
78 virtual void Next() = 0;
79 virtual bool IsDone()
const = 0;
80 virtual Item CurrentItem()
const = 0;
93 virtual int size() {
return vector_->size();}
98 if(
index < (
unsigned int)vector_->size())
return false ;
104 return vector_->operator[](
index) ;
114 static unsigned int id=10;
123 id_(10),level_(0),folderName_(
std::
move(name)),
127 for(
auto & subfolder : subfolders_)
136 for(
auto & subfolder : subfolders_)
137 if ( subfolder->name()==
name )
145 unsigned int id() {
return id_;}
147 unsigned int level() {
return level_;}
152 subfolders_.push_back(f);
159 for(
auto & subfolder : subfolders_)
160 result += subfolder->getHistos();
165 for(
auto & subfolder : subfolders_)
166 result += subfolder->getBins();
171 for(
auto & subfolder : subfolders_)
172 result += subfolder->getEmptyBins();
177 for(
auto & subfolder : subfolders_)
178 result += subfolder->getMemory();
192 std::cout << indent <<
"I'm a " <<
name() <<
" whose father is " << getFather()
193 <<
" with ID: " << id_
194 <<
" Histo: " << getHistos() <<
" Bins: " << getBins()
195 <<
" EmptyBins: " << getEmptyBins() <<
" Memory: " << getMemory()
196 <<
" and my children are: " << std::endl;
197 for(
auto & subfolder : subfolders_)
198 subfolder->dump(indent) ;
207 std::stringstream
s(
"");
208 s <<
"INSERT INTO mainrows(id, symbol_id, self_count, cumulative_count, kids, self_calls, total_calls, self_paths, total_paths, pct)" 209 " VALUES(" << id_ <<
", " << id_ <<
", " 210 << getMemory() <<
", " << getMemory() <<
", " << subfolders_.size() <<
", " 211 << getBins() - getEmptyBins() <<
", " << getBins() <<
", " 212 << getHistos() <<
", " << getHistos() <<
", 0.0);\n";
213 sql_statement.append(s.str());
214 for(
auto & subfolder : subfolders_)
215 subfolder->mainrows(sql_statement) ;
220 unsigned int parentid = this->getFather() ? this->getFather()->id() : id_;
221 std::stringstream
s(
"");
222 s <<
"INSERT INTO symbols(id, name, filename_id) VALUES (" << id_ <<
",\"" << folderName_ <<
"\", " 223 << parentid <<
");\n" ;
224 sql_statement.append(s.str());
225 for(
auto & subfolder : subfolders_)
226 subfolder->symbols(sql_statement) ;
231 unsigned int parentid = this->getFather() ? this->getFather()->id() : id_;
232 std::stringstream
s(
"");
233 s <<
"INSERT INTO parents(self_id, child_id, to_child_count, to_child_calls, to_child_paths, pct) VALUES(" 236 sql_statement.append(s.str());
237 for(
auto & subfolder : subfolders_)
238 subfolder->parents(sql_statement) ;
243 unsigned int parentid = this->getFather() ? this->getFather()->id() : id_;
244 std::stringstream
s(
"");
245 s <<
"INSERT INTO children(self_id, parent_id, from_parent_count, from_parent_calls, from_parent_paths, pct) VALUES(" 246 << id_ <<
"," << parentid <<
"," 247 << getMemory() <<
"," << getBins() - getEmptyBins()
249 sql_statement.append(s.str());
250 for(
auto & subfolder : subfolders_)
251 subfolder->children(sql_statement) ;
256 std::stringstream
s(
"");
257 s <<
"INSERT INTO mainrows(id, symbol_id, self_count, cumulative_count, kids, self_calls, total_calls, self_paths, total_paths, pct)" 258 <<
" VALUES(" << id_ <<
"," << id_ <<
"," << 0 <<
"," << getMemory() <<
", 0," 259 << getBins()-getEmptyBins() <<
"," << getBins()
260 <<
", 0, " << getHistos() <<
", 0);\n";
261 sql_statement.append(s.str());
266 std::stringstream
s(
"");
267 s <<
"INSERT INTO summary(counter, total_count, total_freq, tick_period) VALUES (\"BINS_LIVE\"," 268 << getMemory() <<
"," << getBins() <<
", 1);\n";
269 sql_statement.append(s.str());
274 std::stringstream
s(
"");
275 s <<
"INSERT INTO files(id, name) VALUES(" << id_ <<
",\"" << folderName_ <<
"\");\n" ;
276 sql_statement.append(s.str());
299 enum statsMode { considerAllME = 0, considerOnlyLumiProductME = 1 };
323 void endJob()
override;
327 int calcstats(
int );
328 void calcIgProfDump(
Folder &);
329 void dumpMemoryProfile( );
330 std::pair<unsigned int, unsigned int> readMemoryEntry( )
const;
std::string subfolderName_
static unsigned int getId()
void AddBinsS(unsigned int nBins, unsigned int nEmptyBins)
void update(unsigned int bins, unsigned int empty, unsigned int memory)
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void AddBinsD(unsigned int nBins, unsigned int nEmptyBins)
VIterator(const std::vector< Item > *aVector)
std::vector< std::pair< time_t, unsigned int > > memoryHistoryVector_
std::string subsystemName_
void mainrows_cumulative(std::string &sql_statement)
unsigned int getEmptyBins()
VIterator< Folder * > CreateIterator()
S & print(S &os, JobReport::InputFile const &f)
Item CurrentItem() const override
unsigned int totalMemory_
void summary(std::string &sql_statement)
std::string maxbinsmeglobal_
void mainrows(std::string &sql_statement)
std::vector< Folder * > subfolders_
const std::string & name()
bool isOpenProcFileSuccessful_
unsigned int totalEmptyBins_
void setLevel(unsigned int value)
unsigned int totalEmptyBins_
std::string pathnamematch_
std::string maxbinsmesubsys_
void files(std::string &sql_statement)
void setFather(Folder *e)
void dump(std::string indent)
bool IsDone() const override
unsigned int totalHistos_
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
void parents(std::string &sql_statement)
Folder * cd(const std::string &name)
edm::ParameterSet parameters_
unsigned int totalMemory_
void AddBinsF(unsigned int nBins, unsigned int nEmptyBins)
std::vector< std::vector< double > > tmp
void children(std::string &sql_statement)
unsigned int totalHistos_
const std::vector< Item > * vector_
std::stringstream procFileName_
void symbols(std::string &sql_statement)
void setId(unsigned int id)