with percentage information
parent
b4216b325b
commit
e9ae2b5cc7
|
|
@ -86,35 +86,43 @@ void TimingOutline::print(const std::string& outline) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimingOutline::print2(const std::string& outline) const {
|
void TimingOutline::print2(const std::string& outline, const double parentTotal) const {
|
||||||
|
|
||||||
const int w1 = 24, w2 = 3, w3 = 8, precision = 3;
|
const int w1 = 24, w2 = 2, w3 = 6, w4 = 8, precision = 2;
|
||||||
const double selfTotal = double(t_)/(1000000.0),
|
const double selfTotal = double(t_)/(1000000.0),
|
||||||
selfMean = selfTotal/double(n_);
|
selfMean = selfTotal/double(n_);
|
||||||
// const double childMean = double(time())/(1000000.0*n_);
|
const double childTotal = double(time())/(1000000.0);
|
||||||
|
|
||||||
// compute standard deviation
|
// compute standard deviation
|
||||||
const double selfStd = sqrt(t2_/double(n_) - selfMean*selfMean);
|
const double selfStd = sqrt(t2_/double(n_) - selfMean*selfMean);
|
||||||
const std::string label = label_ + ": " ;
|
const std::string label = outline + label_ + ": " ;
|
||||||
|
|
||||||
if ( n_ == 0 ) {
|
if ( n_ == 0 ) {
|
||||||
std::cout << label << std::fixed << std::setprecision(precision) << double(time())/(1000000.0) << " seconds" << std::endl;
|
std::cout << label << std::fixed << std::setprecision(precision) << childTotal << " seconds" << std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << std::setw(w1) << label ;
|
std::cout << std::setw(w1+outline.length()) << label ;
|
||||||
std::cout << std::setiosflags(std::ios::right) << std::setw(w2) << n_ << " (times), "
|
std::cout << std::setiosflags(std::ios::right) << std::setw(w2) << n_ << " (times), "
|
||||||
<< std::setiosflags(std::ios::right) << std::fixed << std::setw(w3) << std::setprecision(precision) << selfMean << " (mean), "
|
<< std::setiosflags(std::ios::right) << std::fixed << std::setw(w3) << std::setprecision(precision) << selfMean << " (mean), "
|
||||||
<< std::setiosflags(std::ios::right) << std::fixed << std::setw(w3) << std::setprecision(precision) << selfStd << " (std),"
|
<< std::setiosflags(std::ios::right) << std::fixed << std::setw(w3) << std::setprecision(precision) << selfStd << " (std),"
|
||||||
<< std::setiosflags(std::ios::right) << std::fixed << std::setw(w3) << std::setprecision(precision) << selfTotal << " (total)"
|
<< std::setiosflags(std::ios::right) << std::fixed << std::setw(w4) << std::setprecision(precision) << selfTotal << " (total),";
|
||||||
//<< std::setprecision(precision) << std::setw(w3) << std::fixed << childMean << " (child-mean)"
|
|
||||||
<< std::endl;
|
if ( parentTotal > 0.0 )
|
||||||
|
std::cout << std::setiosflags(std::ios::right) << std::fixed << std::setw(w3) << std::setprecision(precision) << 100.0*selfTotal/parentTotal << " (%)";
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i=0; i<children_.size(); ++i) {
|
for(size_t i=0; i<children_.size(); ++i) {
|
||||||
if(children_[i]) {
|
if(children_[i]) {
|
||||||
std::string childOutline(outline);
|
std::string childOutline(outline);
|
||||||
|
if ( n_ == 0 ) {
|
||||||
|
children_[i]->print2(childOutline, childTotal);
|
||||||
|
}
|
||||||
|
else {
|
||||||
childOutline += " ";
|
childOutline += " ";
|
||||||
children_[i]->print2(childOutline);
|
children_[i]->print2(childOutline, selfTotal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
void print(const std::string& outline = "") const;
|
void print(const std::string& outline = "") const;
|
||||||
|
|
||||||
void print2(const std::string& outline = "") const;
|
void print2(const std::string& outline = "", const double parentTotal = -1.0) const;
|
||||||
|
|
||||||
const boost::shared_ptr<TimingOutline>& child(size_t child, const std::string& label, const boost::weak_ptr<TimingOutline>& thisPtr);
|
const boost::shared_ptr<TimingOutline>& child(size_t child, const std::string& label, const boost::weak_ptr<TimingOutline>& thisPtr);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue