1 #ifndef DQMStoreStats_H 2 #define DQMStoreStats_H 47 void AddBinsF(
unsigned int nBins,
unsigned int nEmptyBins ) { ++
totalHistos_; totalBins_ += nBins; totalEmptyBins_ += nEmptyBins; totalMemory_ += ( nBins *=
sizeof(
float ) ); }
48 void AddBinsS(
unsigned int nBins,
unsigned int nEmptyBins ) { ++
totalHistos_; totalBins_ += nBins; totalEmptyBins_ += nEmptyBins; totalMemory_ += ( nBins *=
sizeof( short ) ); }
49 void AddBinsD(
unsigned int nBins,
unsigned int nEmptyBins ) { ++
totalHistos_; totalBins_ += nBins; totalEmptyBins_ += nEmptyBins; totalMemory_ += ( nBins *=
sizeof( double ) ); }
76 virtual void First() = 0;
77 virtual void Next() = 0;
78 virtual bool IsDone()
const = 0;
79 virtual Item CurrentItem()
const = 0;
92 virtual int size() {
return vector_->size();}
97 if(
index < (
unsigned int)vector_->size())
return false ;
103 return vector_->operator[](
index) ;
113 static unsigned int id=10;
122 id_(10),level_(0),folderName_(name),
126 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i)
135 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i)
136 if ( (*i)->name()==
name )
144 unsigned int id(
void) {
return id_;}
146 unsigned int level(
void) {
return level_;}
151 subfolders_.push_back(f);
158 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i)
159 result += (*i)->getHistos();
164 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i)
165 result += (*i)->getBins();
170 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i)
171 result += (*i)->getEmptyBins();
176 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i)
177 result += (*i)->getMemory();
191 std::cout << indent <<
"I'm a " <<
name() <<
" whose father is " << getFather()
192 <<
" with ID: " << id_
193 <<
" Histo: " << getHistos() <<
" Bins: " << getBins()
194 <<
" EmptyBins: " << getEmptyBins() <<
" Memory: " << getMemory()
195 <<
" and my children are: " << std::endl;
196 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i )
206 std::stringstream
s(
"");
207 s <<
"INSERT INTO mainrows(id, symbol_id, self_count, cumulative_count, kids, self_calls, total_calls, self_paths, total_paths, pct)" 208 " VALUES(" << id_ <<
", " << id_ <<
", " 209 << getMemory() <<
", " << getMemory() <<
", " << subfolders_.size() <<
", " 210 << getBins() - getEmptyBins() <<
", " << getBins() <<
", " 211 << getHistos() <<
", " << getHistos() <<
", 0.0);\n";
212 sql_statement.append(s.str());
213 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i )
214 (*i)->mainrows(sql_statement) ;
219 unsigned int parentid = this->getFather() ? this->getFather()->id() : id_;
220 std::stringstream
s(
"");
221 s <<
"INSERT INTO symbols(id, name, filename_id) VALUES (" << id_ <<
",\"" << folderName_ <<
"\", " 222 << parentid <<
");\n" ;
223 sql_statement.append(s.str());
224 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i )
225 (*i)->symbols(sql_statement) ;
230 unsigned int parentid = this->getFather() ? this->getFather()->id() : id_;
231 std::stringstream
s(
"");
232 s <<
"INSERT INTO parents(self_id, child_id, to_child_count, to_child_calls, to_child_paths, pct) VALUES(" 235 sql_statement.append(s.str());
236 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i )
237 (*i)->parents(sql_statement) ;
242 unsigned int parentid = this->getFather() ? this->getFather()->id() : id_;
243 std::stringstream
s(
"");
244 s <<
"INSERT INTO children(self_id, parent_id, from_parent_count, from_parent_calls, from_parent_paths, pct) VALUES(" 245 << id_ <<
"," << parentid <<
"," 246 << getMemory() <<
"," << getBins() - getEmptyBins()
248 sql_statement.append(s.str());
249 for(std::vector<Folder*>::iterator
i = subfolders_.begin(),
e = subfolders_.end() ;
i !=
e ; ++
i )
250 (*i)->children(sql_statement) ;
255 std::stringstream
s(
"");
256 s <<
"INSERT INTO mainrows(id, symbol_id, self_count, cumulative_count, kids, self_calls, total_calls, self_paths, total_paths, pct)" 257 <<
" VALUES(" << id_ <<
"," << id_ <<
"," << 0 <<
"," << getMemory() <<
", 0," 258 << getBins()-getEmptyBins() <<
"," << getBins()
259 <<
", 0, " << getHistos() <<
", 0);\n";
260 sql_statement.append(s.str());
265 std::stringstream
s(
"");
266 s <<
"INSERT INTO summary(counter, total_count, total_freq, tick_period) VALUES (\"BINS_LIVE\"," 267 << getMemory() <<
"," << getBins() <<
", 1);\n";
268 sql_statement.append(s.str());
273 std::stringstream
s(
"");
274 s <<
"INSERT INTO files(id, name) VALUES(" << id_ <<
",\"" << folderName_ <<
"\");\n" ;
275 sql_statement.append(s.str());
298 enum statsMode { considerAllME = 0, considerOnlyLumiProductME = 1 };
326 int calcstats(
int );
327 void calcIgProfDump(
Folder &);
328 void dumpMemoryProfile(
void );
329 std::pair<unsigned int, unsigned int> readMemoryEntry(
void )
const;
std::string subfolderName_
void AddBinsS(unsigned int nBins, unsigned int nEmptyBins)
void update(unsigned int bins, unsigned int empty, unsigned int memory)
def analyze(function, filename, filter=None)
void AddBinsD(unsigned int nBins, unsigned int nEmptyBins)
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
virtual bool IsDone() const
static unsigned int getId(void)
VIterator(const std::vector< Item > *aVector)
std::vector< std::pair< time_t, unsigned int > > memoryHistoryVector_
std::string subsystemName_
unsigned int getBins(void)
void mainrows_cumulative(std::string &sql_statement)
VIterator< Folder * > CreateIterator()
unsigned int totalMemory_
void summary(std::string &sql_statement)
const std::string & name(void)
std::string maxbinsmeglobal_
void mainrows(std::string &sql_statement)
std::vector< Folder * > subfolders_
bool isOpenProcFileSuccessful_
unsigned int totalEmptyBins_
void setLevel(unsigned int value)
unsigned int totalEmptyBins_
std::string pathnamematch_
std::string maxbinsmesubsys_
unsigned int getHistos(void)
void files(std::string &sql_statement)
void setFather(Folder *e)
void dump(std::string indent)
virtual Item CurrentItem() const
unsigned int totalHistos_
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
void parents(std::string &sql_statement)
Folder(const std::string name)
Folder * cd(const std::string &name)
edm::ParameterSet parameters_
unsigned int totalMemory_
unsigned int getEmptyBins(void)
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)
unsigned int getMemory(void)
void setId(unsigned int id)