File tree 3 files changed +27
-11
lines changed
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)
47
47
out << " space available in freed fastbin blocks: " << m.fsmblks << " \n " ;
48
48
out << " total allocated space: " << m.uordblks << " \n " ;
49
49
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)
55
51
PROCESS_MEMORY_COUNTERS pmc;
56
52
if (GetProcessMemoryInfo (GetCurrentProcess (), &pmc, sizeof (pmc)))
57
53
{
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 " ;
60
57
}
61
- #endif
62
- #endif
63
-
64
- #ifdef __APPLE__
58
+ #elif defined(__APPLE__)
65
59
// NOLINTNEXTLINE(readability/identifiers)
66
60
struct task_basic_info t_info;
67
61
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 \
49
49
util/graph.cpp \
50
50
util/irep.cpp \
51
51
util/irep_sharing.cpp \
52
+ util/memory_info.cpp \
52
53
util/message.cpp \
53
54
util/optional.cpp \
54
55
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