Skip to content

Commit

Permalink
pinfo support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
yyzybb537 committed Jan 27, 2016
1 parent cb53279 commit 78ec7cc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/gtest_unit/pinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#ifndef _WIN32
#include <unistd.h>
#include <boost/algorithm/string.hpp>
#else
#include <Windows.h>
#include <Psapi.h>
#pragma comment(lib,"Psapi.lib")
#endif

#include <fstream>
#include <string>
#include <vector>
Expand Down Expand Up @@ -51,6 +56,12 @@ struct pinfo
sscanf(s.c_str(), "VmSwap: %llu KB", (long long unsigned int*)&swap);
}
}
#else
PROCESS_MEMORY_COUNTERS meminfo;
GetProcessMemoryInfo(GetCurrentProcess(), &meminfo, sizeof(meminfo));
rss_high = meminfo.PeakWorkingSetSize / 1024;
rss = meminfo.WorkingSetSize / 1024;
virt_high = virt = 0;
#endif
}

Expand Down

0 comments on commit 78ec7cc

Please sign in to comment.