#include <hawktracer/base_types.h>
#include <hawktracer/ht_config.h>
Go to the source code of this file.
◆ HT_MEMORY_USAGE_INVALID_VALUE
#define HT_MEMORY_USAGE_INVALID_VALUE ((size_t)-1) |
Defines an invalid value for memory which is returned when getting a memory usage fails.
◆ HT_MemoryUsageContext
A forward declaration for memory usage context.
This structure should be defined in the implementation file.
◆ ht_memory_usage_context_create()
Creates a context for a memory usage feature.
This context is used for getting memory usage, and the structure is platform specific. The context should always be destroyed using ht_memory_usage_context_destroy().
- Parameters
-
process_id | a platform specific description of process ID, or NULL to get memory usage of the current process. For linux-based platforms, it should be a pointer to a variable of type integer (int), which holds the process ID. |
- Returns
- the memory usage context or NULL if the function failed to create a context.
◆ ht_memory_usage_context_destroy()
Destroys memory context.
- Parameters
-
context | a pointer to the context. |
◆ ht_memory_usage_get_usage()
Gets a memory usage of the process in kilobytes.
The process ID should be specified in ht_memory_usage_context_create().
- Parameters
-
context | a memory usage context. |
- Returns
- a memory usage of a specified process in kilobytes, or HT_MEMORY_USAGE_INVALID_VALUE value on error. Gets a memory usage of the process in bytes.
- Parameters
-
context | a memory usage context. |
virtual_memory_bytes | a pointer to a variable where virtual memory used by the process will be stored, or NULL if the value should not be read. |
shared_memory_bytes | a pointer to a variable where shared memory used by the process will be stored, or NULL if the value should not be read. |
resident_memory_bytes | a pointer to a variable where resident memory used by the process will be stored, or NULL if the value should not be read. |
- Returns
- HT_ERR_OK, if memory has been read succesfully; otherwise, appropriate error code.