diff --git a/common/include/villas/hist.hpp b/common/include/villas/hist.hpp index fb7f3ce21..3c7acb33e 100644 --- a/common/include/villas/hist.hpp +++ b/common/include/villas/hist.hpp @@ -44,7 +44,7 @@ public: double getStddev() const; // Print all statistical properties of distribution including a graphical plot of the histogram. - void print(Logger logger, bool details) const; + void print(Logger logger, bool details, std::string prefix = "") const; // Print ASCII style plot of histogram. void plot(Logger logger) const; diff --git a/common/lib/hist.cpp b/common/lib/hist.cpp index 7d28e48ad..668973afa 100644 --- a/common/lib/hist.cpp +++ b/common/lib/hist.cpp @@ -97,28 +97,28 @@ double Hist::getVar() const { double Hist::getStddev() const { return sqrt(getVar()); } -void Hist::print(Logger logger, bool details) const { +void Hist::print(Logger logger, bool details, std::string prefix) const { if (total > 0) { Hist::cnt_t missed = total - higher - lower; - logger->info("Counted values: {} ({} between {} and {})", total, missed, + logger->info("{}Counted values: {} ({} between {} and {})", prefix, total, missed, low, high); - logger->info("Highest: {:g}", highest); - logger->info("Lowest: {:g}", lowest); - logger->info("Mu: {:g}", getMean()); - logger->info("1/Mu: {:g}", 1.0 / getMean()); - logger->info("Variance: {:g}", getVar()); - logger->info("Stddev: {:g}", getStddev()); + logger->info("{}Highest: {:g}", prefix, highest); + logger->info("{}Lowest: {:g}", prefix, lowest); + logger->info("{}Mu: {:g}", prefix, getMean()); + logger->info("{}1/Mu: {:g}", prefix, 1.0 / getMean()); + logger->info("{}Variance: {:g}", prefix, getVar()); + logger->info("{}Stddev: {:g}", prefix, getStddev()); if (details && total - higher - lower > 0) { char *buf = dump(); - logger->info("Matlab: {}", buf); + logger->info("{}Matlab: {}", prefix, buf); free(buf); plot(logger); } } else - logger->info("Counted values: {}", total); + logger->info("{}Counted values: {}", prefix, total); } void Hist::plot(Logger logger) const { diff --git a/lib/stats.cpp b/lib/stats.cpp index d6b352dcd..5f2fd4428 100644 --- a/lib/stats.cpp +++ b/lib/stats.cpp @@ -188,7 +188,7 @@ void Stats::print(FILE *f, enum Format fmt, int verbose) const { case Format::HUMAN: for (auto m : metrics) { logger->info("{}: {}", m.second.name, m.second.desc); - histograms.at(m.first).print(logger, verbose); + histograms.at(m.first).print(logger, verbose, " "); } break;