/usr/include/libMems-1.6/libMems/Memory.h is in libmems-1.6-dev 1.6.0+4725-4build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #ifndef __libMems_Memory_h__
#define __libMems_Memory_h__
void printMemUsage();
static bool debugging_memory = false;
#include <iostream>
#ifdef WIN32
#include <windows.h>
#include <PSAPI.h>
inline
void printMemUsage()
{
// if(!debugging_memory)
// return;
DWORD proclist[500];
DWORD cbNeeded;
BOOL rval;
rval = EnumProcesses( proclist, sizeof(proclist), &cbNeeded );
int p_count = cbNeeded / sizeof(DWORD);
HANDLE phand;
HMODULE hMod;
char szFileName[MAX_PATH];
for( int p = 0; p < p_count; p++ )
{
phand = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, proclist[p] );
DWORD dwSize2;
if (EnumProcessModules(phand, &hMod, sizeof(hMod), &dwSize2))
{
// Get the module name
if ( !GetModuleBaseName(phand, hMod, szFileName, sizeof(szFileName)) )
szFileName[0] = 0;
if( strncmp( szFileName, "progressiveMauve", 16 ) == 0 )
break; // found the right module
}
CloseHandle(phand);
}
PROCESS_MEMORY_COUNTERS mem_info;
if( GetProcessMemoryInfo( phand, &mem_info, sizeof(mem_info) ) )
{
std::cout << "Working set size: " << mem_info.WorkingSetSize / (1024 * 1024) << " Mb\n";
// cout << "Paged pool usage: " << mem_info.QuotaPagedPoolUsage << endl;
// cout << "Non-Paged pool usage: " << mem_info.QuotaNonPagedPoolUsage << endl;
std::cout << "Pagefile usage: " << mem_info.PagefileUsage / (1024 * 1024) << " Mb\n";
std::cout.flush();
}
}
#else
inline
void printMemUsage()
{};
#endif
#endif //__libMems_Memory_h__
|