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 @@ -47,21 +47,15 @@ void memory_info(std::ostream &out)
4747 out << " space available in freed fastbin blocks: " << m.fsmblks << " \n " ;
4848 out << " total allocated space: " << m.uordblks << " \n " ;
4949 out << " total free space: " << m.fordblks << " \n " ;
50- #endif
51-
52- #ifdef _WIN32
53- (void )out; // unused parameter
54- #if 0
50+ #elif defined(_WIN32)
5551 PROCESS_MEMORY_COUNTERS pmc;
5652 if (GetProcessMemoryInfo (GetCurrentProcess (), &pmc, sizeof (pmc)))
5753 {
58- out << " PeakWorkingSetSize: " << pmc.PeakWorkingSetSize << "\n";
59- out << " WorkingSetSize: " << pmc.WorkingSetSize << "\n";
54+ out << " peak working set size [bytes]: " << pmc.PeakWorkingSetSize
55+ << " \n " ;
56+ out << " current working set size [bytes]: " << pmc.WorkingSetSize << " \n " ;
6057 }
61- #endif
62- #endif
63-
64- #ifdef __APPLE__
58+ #elif defined(__APPLE__)
6559 // NOLINTNEXTLINE(readability/identifiers)
6660 struct task_basic_info t_info;
6761 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::ostringstream oss;
18+ memory_info (oss);
19+
20+ REQUIRE (!oss.str ().empty ());
21+ }
You can’t perform that action at this time.
0 commit comments