![]() |
LTTng control library C API
|

Data Structures | |
| struct | lttng_reclaim_handle |
| Event record channel memory reclaim operation handle (opaque type). More... | |
Functions | |
| enum lttng_reclaim_channel_memory_status | lttng_reclaim_channel_memory (const char *session_name, const char *channel_name, enum lttng_domain_type domain, uint64_t older_than_us, struct lttng_reclaim_handle **handle) |
Initiates an immediate memory reclaim operation for the event record channel named channel_name within the recording session named session_name and the tracing domain domain. | |
| void | lttng_reclaim_handle_destroy (struct lttng_reclaim_handle *handle) |
Destroys the event record channel memory reclaim operation handle handle. | |
| enum lttng_reclaim_handle_status | lttng_reclaim_handle_get_pending_subbuffer_count (const struct lttng_reclaim_handle *handle, uint64_t *count) |
Sets *count to the total number of sub-buffers pending reclamation from the event record channel memory reclaim operation identified by handle. | |
| enum lttng_reclaim_handle_status | lttng_reclaim_handle_get_reclaimed_subbuffer_count (const struct lttng_reclaim_handle *handle, uint64_t *count) |
Sets *count to the total number of sub-buffers successfully reclaimed by the event record channel memory reclaim operation identified by handle. | |
| enum lttng_reclaim_handle_status | lttng_reclaim_handle_wait_for_completion (struct lttng_reclaim_handle *handle, int timeout_ms) |
Waits for the event record channel memory reclaim operation identified by handle to complete. | |
An event record channel memory reclaim operation makes it possible to free memory which the eligible sub-buffers of a user space event record channel use.
The event record channel memory reclaim operation behaviour depends on the configured event record loss mode of the event record channel:
Only reclaim sub-buffers that have been both delivered (completed and ready to be consumed) and consumed, since unconsumed data would be lost forever.
There are two ways to reclaim event record channel memory:
Call lttng_reclaim_channel_memory() to initiate an immediate memory reclaim operation.
This function returns a memory reclaim operation handle (lttng_reclaim_handle).
Use lttng_channel_set_automatic_memory_reclamation_policy() before creating the event record channel to enable an automatic memory reclaim.
See Automatic memory reclaim policy to learn more.
In both cases, you may specify a sub-buffer age threshold: only sub-buffers of which the age of the closing time is older than the threshold are eligible for a memory reclaim. Moreover, with some age threshold T:
The sub-buffers of which the age, at the moment of closing them, is greater than T are eligible for a memory reclaim.
All the sub-buffers are eligible.
The LTTng tracers flush for the targeted event record channel so that any open sub-buffer gets closed to become eligible.
You might want to use this feature in conjunction with the LTTNG_CHANNEL_PREALLOCATION_POLICY_ON_DEMAND buffer preallocation policy of the event record channel to also minimize initial memory usage.
Return type of lttng_reclaim_channel_memory().
Error status enumerators have a negative value.
Return type of event record channel memory reclaim handle functions.
Error status enumerators have a negative value.
|
extern |
Initiates an immediate memory reclaim operation for the event record channel named channel_name within the recording session named session_name and the tracing domain domain.
This function requests LTTng to immediately reclaim memory which the buffers of the targeted event record channel use in order to free space.
This function only works with a user space event record channel.
Use *handle to wait for the completion of the memory reclaim operation and to fetch its result.
| [in] | session_name | Name of the recording session which contains the targeted event record channel. |
| [in] | channel_name | Name of the targeted event record channel within session_name from which to reclaim memory. |
| [in] | domain | Tracing domain of the targeted event record channel. |
| [in] | older_than_us | Minimum age (µs) of buffered data to consider to reclaim memory. Set to 0 for no age constraint. |
| [out] | handle | On success, this function sets May be Wait for the completion of this operation with lttng_reclaim_handle_wait_for_completion(). Destroy |
| LTTNG_RECLAIM_CHANNEL_MEMORY_STATUS_OK | Success. |
| LTTNG_RECLAIM_CHANNEL_MEMORY_STATUS_ERROR | Error. |
| LTTNG_RECLAIM_CHANNEL_MEMORY_STATUS_INVALID_PARAMETER | Unsatisfied precondition. |
session_name is not NULL.session_name names an accessible recording session within the connected session daemon.channel_name is not NULL.domain is LTTNG_DOMAIN_UST, LTTNG_DOMAIN_JUL, LTTNG_DOMAIN_LOG4J, LTTNG_DOMAIN_LOG4J2, or LTTNG_DOMAIN_PYTHON.
|
extern |
Destroys the event record channel memory reclaim operation handle handle.
| [in] | handle | Event record channel memory reclaim operation handle to destroy. May be |
|
extern |
Sets *count to the total number of sub-buffers pending reclamation from the event record channel memory reclaim operation identified by handle.
Pending sub-buffers are sub-buffers that met the reclamation criteria but could not be immediately reclaimed because their data has not yet been consumed. These sub-buffers will be automatically reclaimed as they are consumed.
The pending sub-buffer count is available immediately after lttng_reclaim_channel_memory() returns successfully.
| [in] | handle | Handle of the event record channel memory reclaim operation from which to get the number of pending sub-buffers. |
| [out] | count | On success, this function sets *count to the number of sub-buffers pending reclamation. |
| LTTNG_RECLAIM_HANDLE_STATUS_OK | Success. |
| LTTNG_RECLAIM_HANDLE_STATUS_INVALID | Unsatisfied precondition. |
handle is not NULL.count is not NULL.
|
extern |
Sets *count to the total number of sub-buffers successfully reclaimed by the event record channel memory reclaim operation identified by handle.
The reclaimed sub-buffer count is available immediately after lttng_reclaim_channel_memory() returns successfully.
| [in] | handle | Handle of the event record channel memory reclaim operation from which to get the number of reclaimed sub-buffers. |
| [out] | count | On success, this function sets *count to the number of sub-buffers successfully reclaimed. |
| LTTNG_RECLAIM_HANDLE_STATUS_OK | Success. |
| LTTNG_RECLAIM_HANDLE_STATUS_INVALID | Unsatisfied precondition. |
handle is not NULL.count is not NULL.
|
extern |
Waits for the event record channel memory reclaim operation identified by handle to complete.
If this function returns LTTNG_RECLAIM_HANDLE_STATUS_COMPLETED, then the memory reclaim operation identified by handle completed. This does not indicate whether the memory reclaim operation itself succeeded; use lttng_reclaim_handle_get_reclaimed_subbuffer_count() to get the reclaimed count.
| [in] | handle | Event record channel memory reclaim operation handle of which to wait for completion. |
| [in] | timeout_ms | Maximum time (milliseconds) to wait for the completion of the memory reclaim operation identified by handle before returning LTTNG_RECLAIM_HANDLE_STATUS_TIMEOUT, or -1 to wait indefinitely. |
| LTTNG_RECLAIM_HANDLE_STATUS_COMPLETED | The memory reclaim operation identified by handle completed (with or without success). |
| LTTNG_RECLAIM_HANDLE_STATUS_INVALID | Unsatisfied precondition. |
| LTTNG_RECLAIM_HANDLE_STATUS_TIMEOUT | The function waited for the completion of the memory reclaim operation more than timeout_ms ms. |
| LTTNG_RECLAIM_HANDLE_STATUS_ERROR | Other error. |
handle is not NULL.