00001 #ifndef Impala_Util_MemReport_h
00002 #define Impala_Util_MemReport_h
00003
00004 #ifdef unix
00005 #include <sys/time.h>
00006 #include <sys/resource.h>
00007 #include <unistd.h>
00008 #endif
00009
00010 namespace Impala
00011 {
00012 namespace Util
00013 {
00014
00015
00016 void PrintMemUsage(String marker)
00017 {
00018 ILOG_VAR(PrintMemUsage);
00019 #ifdef unix
00020 int who = RUSAGE_CHILDREN;
00021 struct rusage usage;
00022 int ret;
00023
00024 ret = getrusage(who, &usage);
00025 void* b = sbrk(0);
00026 UInt64 b2 = (UInt64)b;
00027 ILOG_DEBUG("RUsage " << b2 << " " << usage.ru_idrss << " " << usage.ru_isrss << " " << usage.ru_ixrss << " " << usage.ru_maxrss << " " <<marker);
00028 #else
00029 ILOG_WARNING("PrintMemUsage only implemented for unix");
00030 #endif
00031 }
00032
00033 void PrintMemUsage()
00034 {
00035 PrintMemUsage("");
00036 }
00037
00038 }
00039 }
00040
00041 #endif
00042