File tree Expand file tree Collapse file tree 3 files changed +27
-11
lines changed Expand file tree Collapse file tree 3 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -45,21 +45,15 @@ void memory_info(std::ostream &out)
4545 out << " space available in freed fastbin blocks: " << m.fsmblks << " \n " ;
4646 out << " total allocated space: " << m.uordblks << " \n " ;
4747 out << " total free space: " << m.fordblks << " \n " ;
48- #endif
49-
50- #ifdef _WIN32
51- (void )out; // unused parameter
52- #if 0
48+ #elif defined(_WIN32)
5349 PROCESS_MEMORY_COUNTERS pmc;
5450 if (GetProcessMemoryInfo (GetCurrentProcess (), &pmc, sizeof (pmc)))
5551 {
56- out << " PeakWorkingSetSize: " << pmc.PeakWorkingSetSize << "\n";
57- out << " WorkingSetSize: " << pmc.WorkingSetSize << "\n";
52+ out << " peak working set size [bytes]: " << pmc.PeakWorkingSetSize
53+ << " \n " ;
54+ out << " current working set size [bytes]: " << pmc.WorkingSetSize << " \n " ;
5855 }
59- #endif
60- #endif
61-
62- #ifdef __APPLE__
56+ #elif defined(__APPLE__)
6357 // NOLINTNEXTLINE(readability/identifiers)
6458 struct task_basic_info t_info;
6559 mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ SRC += analyses/ai/ai.cpp \
4949 util/graph.cpp \
5050 util/irep.cpp \
5151 util/irep_sharing.cpp \
52+ util/memory_info.cpp \
5253 util/message.cpp \
5354 util/optional.cpp \
5455 util/optional_utils.cpp \
Original file line number Diff line number Diff line change 1+ /* ******************************************************************\
2+
3+ Module: Unit tests for memory_info.h
4+
5+ Author: Michael Tautschnig
6+
7+ \*******************************************************************/
8+
9+ #include < testing-utils/catch.hpp>
10+
11+ #include < util/memory_info.h>
12+
13+ #include < sstream>
14+
15+ TEST_CASE (" memory_info returns some output" , " [core][util][memory_info]" )
16+ {
17+ std::ostringstring oss;
18+ memory_info (oss);
19+
20+ REQUIRE (!oss.str ().empty ());
21+ }
You can’t perform that action at this time.
0 commit comments