diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 8abe9254b..dfa27b99e 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -41,6 +41,7 @@ class StatsVisitor final : public VNVisitorConst { // STATE const bool m_fastOnly; // When true, consider only fast functions + bool m_empty = true; // Netlist is empty Counters m_counters; // The actual counts we will display Counters m_dumpster; // Alternate buffer to make discarding parts of the tree easier Counters* m_accump; // The currently active accumulator @@ -51,6 +52,7 @@ class StatsVisitor final : public VNVisitorConst { // METHODS void countThenIterateChildren(AstNode* nodep) { ++m_accump->m_statTypeCount[nodep->type()]; + if (nodep->type() != VNType::Netlist) m_empty = false; iterateChildrenConst(nodep); } @@ -93,6 +95,7 @@ public: , m_accump{fastOnly ? &m_dumpster : &m_counters} { UINFO(9, "Starting stats, fastOnly=" << fastOnly); iterateConst(nodep); + if (m_empty) return; // Shorthand const auto addStat = [&](const std::string& name, double count, unsigned precision = 0) { @@ -127,13 +130,13 @@ public: addStat("Node count, " + typeName(t), count); } } - addStat("Node memory TOTAL (MiB)", totalNodeMemoryUsage >> 20); + addStat("Node mem TOTAL (MiB)", totalNodeMemoryUsage >> 20); // Node Memory usage for (size_t t = 0; t < VNType::NUM_TYPES(); ++t) { if (const uint64_t count = m_counters.m_statTypeCount[t]) { const double share = 100.0 * count * typeSize(t) / totalNodeMemoryUsage; - addStat("Node memory share (%), " + typeName(t), share, 2); + addStat("Node mem %, " + typeName(t), share, 2); } } diff --git a/src/V3StatsReport.cpp b/src/V3StatsReport.cpp index 32556cb0a..1bf7c512d 100644 --- a/src/V3StatsReport.cpp +++ b/src/V3StatsReport.cpp @@ -119,11 +119,11 @@ class StatsReport final { // Header os << " Stat " << std::left << std::setw(maxWidth - 5 - 2) << ""; - for (const string& i : stages) os << " " << std::left << std::setw(9) << i; + for (const string& i : stages) os << " " << std::left << std::setw(9) << i; os << '\n'; os << " -------- " << std::left << std::setw(maxWidth - 5 - 2) << ""; for (auto it = stages.begin(); it != stages.end(); ++it) { - os << " " << std::left << std::setw(9) << "-------"; + os << " " << std::left << std::setw(9) << "-------"; } // os<name(); } while (col < stages.size() && stages.at(col) != repp->stage()) { - os << std::setw(11) << ""; + os << std::setw(10) << ""; col++; } repp->dump(os); @@ -191,7 +191,7 @@ StatsReport::StatColl StatsReport::s_allStats; // V3Statstic class void V3Statistic::dump(std::ofstream& os) const { - os << " " << std::right << std::fixed << std::setprecision(precision()) << std::setw(9) + os << " " << std::right << std::fixed << std::setprecision(precision()) << std::setw(9) << value(); }