diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 1631d6e4a..b7778d2de 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -26,6 +26,7 @@ # include "V3Global.h" # include "V3Control.h" # include "V3File.h" +# include "V3Stats.h" #endif #include "V3Waiver.h" // clang-format on @@ -551,6 +552,18 @@ void FileLine::operator delete(void* objp, size_t size) { } #endif +void FileLine::stats() { +#ifndef V3ERROR_NO_GLOBAL_ + V3Stats::addStatSum("FileLines, Number of filenames", + singleton().m_names.size()); // Max m_filenameno + V3Stats::addStatSum("FileLines, Message enable sets", + singleton().m_internedMsgEns.size()); // Max m_msgEnIdx + // Don't currently have a good path to recording max line/column, + // Infrequently useful, alternatively we could keep globals we update as make each FileLine + // or could use fileLineLeakChecks. +#endif +} + void FileLine::deleteAllRemaining() { #ifdef VL_LEAK_CHECKS // FileLines are allocated, but never nicely freed, as it's much faster diff --git a/src/V3FileLine.h b/src/V3FileLine.h index e7e0cbb8e..0eb250525 100644 --- a/src/V3FileLine.h +++ b/src/V3FileLine.h @@ -213,6 +213,7 @@ public: FileLine* copyOrSameFileLine(); FileLine* copyOrSameFileLineApplied(); static void deleteAllRemaining(); + static void stats(); ~FileLine(); #ifdef VL_LEAK_CHECKS static void* operator new(size_t size); diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 2e1be9ac0..143b7956c 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -119,6 +119,7 @@ V3Global v3Global; static void reportStatsIfEnabled() { if (v3Global.opt.stats()) { + FileLine::stats(); V3Stats::statsFinalAll(v3Global.rootp()); V3Stats::statsReport(); }