parent
645b8cdf24
commit
86fa00416d
|
|
@ -316,6 +316,7 @@ Tracy Narine
|
|||
Trung Nguyen
|
||||
Tudor Timi
|
||||
Tymoteusz Blazejczyk
|
||||
Tyrone Marhguy
|
||||
Udaya Raj Subedi
|
||||
Udi Finkelstein
|
||||
Unai Martinez-Corral
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ The information in this report is:
|
|||
|
||||
.. describe:: "allocated 123 MB"
|
||||
|
||||
Total memory used during simulation in megabytes.
|
||||
Peak resident memory used during simulation in megabytes.
|
||||
|
||||
|
||||
.. _benchmarking & optimization:
|
||||
|
|
|
|||
|
|
@ -623,5 +623,5 @@ The information in this report is:
|
|||
|
||||
.. describe:: "allocated 123 MB"
|
||||
|
||||
Total memory used during build by Verilator executable (excludes
|
||||
:vlopt:`--build` compiler's usage) in megabytes.
|
||||
Peak resident memory used by the Verilator executable during build
|
||||
(excludes :vlopt:`--build` compiler's usage) in megabytes.
|
||||
|
|
|
|||
|
|
@ -169,17 +169,19 @@ void memUsageBytes(uint64_t& peakr, uint64_t& currentr) VL_MT_SAFE {
|
|||
}
|
||||
#else
|
||||
// Highly unportable. Sorry
|
||||
// Use VmHWM (peak resident), matching Windows PeakWorkingSetSize and macOS resident_size_max.
|
||||
// VmHWM excludes pages swapped out before the peak; /proc has no peak-(RSS+Swap) counter.
|
||||
std::ifstream is{"/proc/self/status"};
|
||||
if (!is) return;
|
||||
std::string line;
|
||||
uint64_t vmPeak = 0;
|
||||
uint64_t vmHwm = 0;
|
||||
uint64_t vmRss = 0;
|
||||
uint64_t vmSwap = 0;
|
||||
std::string field;
|
||||
while (std::getline(is, line)) {
|
||||
if (line.rfind("VmPeak:", 0) == 0) {
|
||||
if (line.rfind("VmHWM:", 0) == 0) {
|
||||
std::stringstream ss{line};
|
||||
ss >> field >> vmPeak;
|
||||
ss >> field >> vmHwm;
|
||||
} else if (line.rfind("VmRSS:", 0) == 0) {
|
||||
std::stringstream ss{line};
|
||||
ss >> field >> vmRss;
|
||||
|
|
@ -188,7 +190,7 @@ void memUsageBytes(uint64_t& peakr, uint64_t& currentr) VL_MT_SAFE {
|
|||
ss >> field >> vmSwap;
|
||||
}
|
||||
}
|
||||
peakr = vmPeak * 1024;
|
||||
peakr = vmHwm * 1024;
|
||||
currentr = (vmRss + vmSwap) * 1024;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@ import vltest_bootstrap
|
|||
|
||||
test.scenarios('vlt')
|
||||
|
||||
test.compile(verilator_flags2=["--stats"])
|
||||
test.compile(verilator_flags2=["--stats --verilate-jobs 2"])
|
||||
|
||||
memUsageMB = int(test.file_grep(test.stats, r'Peak Memory Usage \(MB\) +(\d+)')[0])
|
||||
|
||||
if memUsageMB > 128 and not test.have_dev_asan:
|
||||
test.error("Consumed over 128MB memory")
|
||||
|
||||
test.file_grep(test.stats, r'Verilate jobs: 2')
|
||||
|
||||
test.passes()
|
||||
|
|
|
|||
Loading…
Reference in New Issue