Skip to content

Enable memory_info on Windows #3694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/util/memory_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,15 @@ void memory_info(std::ostream &out)
out << " space available in freed fastbin blocks: " << m.fsmblks << "\n";
out << " total allocated space: " << m.uordblks << "\n";
out << " total free space: " << m.fordblks << "\n";
#endif

#ifdef _WIN32
(void)out; // unused parameter
#if 0
#elif defined(_WIN32)
PROCESS_MEMORY_COUNTERS pmc;
if(GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
{
out << " PeakWorkingSetSize: " << pmc.PeakWorkingSetSize << "\n";
out << " WorkingSetSize: " << pmc.WorkingSetSize << "\n";
out << " peak working set size [bytes]: " << pmc.PeakWorkingSetSize
<< "\n";
out << " current working set size [bytes]: " << pmc.WorkingSetSize << "\n";
}
#endif
#endif

#ifdef __APPLE__
#elif defined(__APPLE__)
// NOLINTNEXTLINE(readability/identifiers)
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
Expand Down
1 change: 1 addition & 0 deletions unit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ SRC += analyses/ai/ai.cpp \
util/graph.cpp \
util/irep.cpp \
util/irep_sharing.cpp \
util/memory_info.cpp \
util/message.cpp \
util/optional.cpp \
util/optional_utils.cpp \
Expand Down
21 changes: 21 additions & 0 deletions unit/util/memory_info.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*******************************************************************\

Module: Unit tests for memory_info.h

Author: Michael Tautschnig

\*******************************************************************/

#include <testing-utils/catch.hpp>

#include <util/memory_info.h>

#include <sstream>

TEST_CASE("memory_info returns some output", "[core][util][memory_info]")
{
std::ostringstream oss;
memory_info(oss);

REQUIRE(!oss.str().empty());
}