Implement OS_DumpMemoryCounters for Linux
This commit is contained in:
parent
74bde98778
commit
fc3e86472a
@ -43,6 +43,9 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <cstdio>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
namespace glslang {
|
||||
|
||||
@ -184,8 +187,18 @@ void ReleaseGlobalLock()
|
||||
pthread_mutex_unlock(&gMutex);
|
||||
}
|
||||
|
||||
// #define DUMP_COUNTERS
|
||||
|
||||
void OS_DumpMemoryCounters()
|
||||
{
|
||||
#ifdef DUMP_COUNTERS
|
||||
struct rusage usage;
|
||||
|
||||
if (getrusage(RUSAGE_SELF, &usage) == 0)
|
||||
printf("Working set size: %ld\n", usage.ru_maxrss * 1024);
|
||||
#else
|
||||
printf("Recompile with DUMP_COUNTERS defined to see counters.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user