summaryrefslogtreecommitdiff
path: root/include/llvm/System
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-20 00:58:53 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-20 00:58:53 +0000
commite6b77ede40392f0b18ea642a7f3f56edbd30770b (patch)
treec72fa3426d88e9985dc8b6fbee7f91b32efd4b6a /include/llvm/System
parent9a5c432a3d82d208c92d82cbf17fc7b6613698a9 (diff)
downloadllvm-e6b77ede40392f0b18ea642a7f3f56edbd30770b.tar.gz
llvm-e6b77ede40392f0b18ea642a7f3f56edbd30770b.tar.bz2
llvm-e6b77ede40392f0b18ea642a7f3f56edbd30770b.tar.xz
For PR351:
* Add GetMallocUsage as a wrapper around mallinfo() * Add GetTotalMemoryUsage to get approximate RSS size * Add GetTimeUsage to get elapsed/system/user time git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/System')
-rw-r--r--include/llvm/System/Process.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/llvm/System/Process.h b/include/llvm/System/Process.h
index 729c000e38..56028fb7bc 100644
--- a/include/llvm/System/Process.h
+++ b/include/llvm/System/Process.h
@@ -14,6 +14,8 @@
#ifndef LLVM_SYSTEM_PROCESS_H
#define LLVM_SYSTEM_PROCESS_H
+#include "llvm/System/TimeValue.h"
+
namespace llvm {
namespace sys {
@@ -32,6 +34,35 @@ namespace sys {
/// @brief Get the virtual memory page size
static unsigned GetPageSize();
+ /// This static function will return the total amount of memory allocated
+ /// by the process. This only counts the memory allocated via the malloc,
+ /// calloc and realloc functions and includes any "free" holes in the
+ /// allocated space.
+ /// @throws nothing
+ /// @brief Return process memory usage.
+ static uint64_t GetMallocUsage();
+
+ /// This static function will return the total memory usage of the
+ /// process. This includes code, data, stack and mapped pages usage. Notei
+ /// that the value returned here is not necessarily the Running Set Size,
+ /// it is the total virtual memory usage, regardless of mapped state of
+ /// that memory.
+ static uint64_t GetTotalMemoryUsage();
+
+ /// This static function will set \p user_time to the amount of CPU time
+ /// spent in user (non-kernel) mode and \p sys_time to the amount of CPU
+ /// time spent in system (kernel) mode. If the operating system does not
+ /// support collection of these metrics, a zero TimeValue will be for both
+ /// values.
+ static void GetTimeUsage(
+ TimeValue& elapsed,
+ ///< Returns the TimeValue::now() giving current time
+ TimeValue& user_time,
+ ///< Returns the current amount of user time for the process
+ TimeValue& sys_time
+ ///< Returns the current amount of system time for the process
+ );
+
/// @}
};
}