mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
stats: Indent histogram output
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
parent
d4bc2409c3
commit
6b0d6891a0
3 changed files with 12 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue