| 534 | |
| 535 | |
| 536 | void WriteRow(std::ostream &ios, const std::string &fname, |
| 537 | const BLProfiler::ProfStats &pstats, const Real percent, |
| 538 | const int colWidth, const Real maxlen, |
| 539 | const bool bwriteavg) |
| 540 | { |
| 541 | int maxlenI = int(maxlen); |
| 542 | int numPrec(4), pctPrec(2); |
| 543 | Real stdDev(0.0), coeffVariation(0.0); |
| 544 | if(pstats.variance > 0.0) { |
| 545 | stdDev = std::sqrt(pstats.variance); |
| 546 | } |
| 547 | if(pstats.avgTime > 0.0) { |
| 548 | coeffVariation = 100.0 * (stdDev / pstats.avgTime); // ---- percent |
| 549 | } |
| 550 | |
| 551 | if(bwriteavg) { |
| 552 | ios << std::right; |
| 553 | ios << std::setw(maxlenI + 2) << fname << " " |
| 554 | << std::setw(colWidth) << pstats.nCalls << " " |
| 555 | << std::setprecision(numPrec) << std::fixed << std::setw(colWidth) |
| 556 | << pstats.minTime << " " |
| 557 | << std::setprecision(numPrec) << std::fixed << std::setw(colWidth) |
| 558 | << pstats.avgTime << " " |
| 559 | << std::setprecision(numPrec) << std::fixed << std::setw(colWidth) |
| 560 | << pstats.maxTime << " " |
| 561 | << std::setprecision(numPrec) << std::fixed << std::setw(colWidth) |
| 562 | << stdDev << " " |
| 563 | << std::setprecision(numPrec) << std::fixed << std::setw(colWidth) |
| 564 | << coeffVariation << " " |
| 565 | << std::setprecision(pctPrec) << std::fixed << std::setw(colWidth) |
| 566 | << percent << " %" << '\n'; |
| 567 | } else { |
| 568 | ios << std::setw(maxlenI + 2) << fname << " " |
| 569 | << std::setw(colWidth) << pstats.nCalls << " " |
| 570 | << std::setprecision(numPrec) << std::fixed << std::setw(colWidth) |
| 571 | << pstats.totalTime << " " |
| 572 | << std::setprecision(pctPrec) << std::fixed << std::setw(colWidth) |
| 573 | << percent << " %" << '\n'; |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | |
| 578 | void WriteStats(std::ostream &ios, |