diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-12-20 16:06:44 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-12-20 16:06:44 +0000 |
commit | bc1ee840019978883dcfa87c301675d257cee9ed (patch) | |
tree | 1adaf9cc3b1e7a8541d2de41f66532afa4b0334c /lib | |
parent | cdb28bed6bdb67d295495214180c42451b11f94e (diff) | |
download | external_llvm-bc1ee840019978883dcfa87c301675d257cee9ed.zip external_llvm-bc1ee840019978883dcfa87c301675d257cee9ed.tar.gz external_llvm-bc1ee840019978883dcfa87c301675d257cee9ed.tar.bz2 |
Consistently use the same #if style. Also, fix a bug testing for sbrk(3)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/System/Unix/Process.cpp | 8 | ||||
-rw-r--r-- | lib/System/Unix/Process.inc | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/System/Unix/Process.cpp b/lib/System/Unix/Process.cpp index 6543904..c9507cb 100644 --- a/lib/System/Unix/Process.cpp +++ b/lib/System/Unix/Process.cpp @@ -50,11 +50,11 @@ static char* som = reinterpret_cast<char*>(::sbrk(0)); uint64_t Process::GetMallocUsage() { -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) struct mallinfo mi; mi = ::mallinfo(); return mi.uordblks; -#elif HAVE_SBRK +#elif defined(HAVE_SBRK) // Note this is only an approximation and more closely resembles // the value returned by mallinfo in the arena field. char * eom = sbrk(0); @@ -71,7 +71,7 @@ Process::GetMallocUsage() uint64_t Process::GetTotalMemoryUsage() { -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) struct mallinfo mi = ::mallinfo(); return mi.uordblks + mi.hblkhd; #else @@ -85,7 +85,7 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time, TimeValue& sys_time) { elapsed = TimeValue::now(); -#ifdef HAVE_GETRUSAGE +#if defined(HAVE_GETRUSAGE) struct rusage usage; ::getrusage(RUSAGE_SELF, &usage); user_time.seconds( usage.ru_utime.tv_sec ); diff --git a/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc index 6543904..c9507cb 100644 --- a/lib/System/Unix/Process.inc +++ b/lib/System/Unix/Process.inc @@ -50,11 +50,11 @@ static char* som = reinterpret_cast<char*>(::sbrk(0)); uint64_t Process::GetMallocUsage() { -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) struct mallinfo mi; mi = ::mallinfo(); return mi.uordblks; -#elif HAVE_SBRK +#elif defined(HAVE_SBRK) // Note this is only an approximation and more closely resembles // the value returned by mallinfo in the arena field. char * eom = sbrk(0); @@ -71,7 +71,7 @@ Process::GetMallocUsage() uint64_t Process::GetTotalMemoryUsage() { -#ifdef HAVE_MALLINFO +#if defined(HAVE_MALLINFO) struct mallinfo mi = ::mallinfo(); return mi.uordblks + mi.hblkhd; #else @@ -85,7 +85,7 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time, TimeValue& sys_time) { elapsed = TimeValue::now(); -#ifdef HAVE_GETRUSAGE +#if defined(HAVE_GETRUSAGE) struct rusage usage; ::getrusage(RUSAGE_SELF, &usage); user_time.seconds( usage.ru_utime.tv_sec ); |