From af511075877c88ff28863006400804cf038a2986 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 1 Mar 2024 20:27:57 -0500 Subject: [PATCH] Fix statistics missing some additions. --- src/V3StatsReport.cpp | 13 ++++++------- test_regress/t/t_const_opt.pl | 2 +- test_regress/t/t_const_opt_dfg.pl | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/V3StatsReport.cpp b/src/V3StatsReport.cpp index c4bc2b7bc..bb5ac347e 100644 --- a/src/V3StatsReport.cpp +++ b/src/V3StatsReport.cpp @@ -37,8 +37,7 @@ class StatsReport final { std::ofstream& os; ///< Output stream static StatColl s_allStats; ///< All statistics - void sumit() { - os << '\n'; + static void sumit() { // If sumit is set on a statistic, combine with others of same name std::multimap byName; // * is always first @@ -53,9 +52,10 @@ class StatsReport final { V3Statistic* repp = itr.second; if (lastp && lastp->sumit() && lastp->printit() && lastp->name() == repp->name() && lastp->stage() == repp->stage()) { - repp->combineWith(lastp); + lastp->combineWith(repp); + } else { + lastp = repp; } - lastp = repp; } } @@ -73,7 +73,7 @@ class StatsReport final { } // Print organized by stage - os << "Global Statistics:\n\n"; + os << "\nGlobal Statistics:\n\n"; for (const auto& itr : byName) { const V3Statistic* repp = itr.second; if (repp->perf()) continue; @@ -81,10 +81,9 @@ class StatsReport final { repp->dump(os); os << '\n'; } - os << '\n'; // Print organized by stage - os << "Performance Statistics:\n\n"; + os << "\nPerformance Statistics:\n\n"; for (const auto& itr : byName) { const V3Statistic* repp = itr.second; if (!repp->perf()) continue; diff --git a/test_regress/t/t_const_opt.pl b/test_regress/t/t_const_opt.pl index 0fdd9fb02..9ce435f7b 100755 --- a/test_regress/t/t_const_opt.pl +++ b/test_regress/t/t_const_opt.pl @@ -20,7 +20,7 @@ execute( ); if ($Self->{vlt}) { - file_grep($Self->{stats}, qr/Optimizations, Const bit op reduction\s+(\d+)/i, 40); + file_grep($Self->{stats}, qr/Optimizations, Const bit op reduction\s+(\d+)/i, 42); } ok(1); 1; diff --git a/test_regress/t/t_const_opt_dfg.pl b/test_regress/t/t_const_opt_dfg.pl index c93977609..547adc392 100755 --- a/test_regress/t/t_const_opt_dfg.pl +++ b/test_regress/t/t_const_opt_dfg.pl @@ -21,7 +21,7 @@ execute( ); if ($Self->{vlt}) { - file_grep($Self->{stats}, qr/Optimizations, Const bit op reduction\s+(\d+)/i, 35); + file_grep($Self->{stats}, qr/Optimizations, Const bit op reduction\s+(\d+)/i, 37); } ok(1); 1;