libocxl
|
These functions control messages from libocxl, such as error messages and tracing. More...
Functions | |
void | ocxl_afu_enable_messages (ocxl_afu_h afu, uint64_t sources) |
Enable messages from an AFU. More... | |
void | ocxl_afu_set_error_message_handler (ocxl_afu_h afu, void(*handler)(ocxl_afu_h afu, ocxl_err error, const char *message)) |
Override the default handler for emitting error messages for an AFU. More... | |
void | ocxl_enable_messages (uint64_t sources) |
Enable messages from libocxl open calls. More... | |
void | ocxl_set_error_message_handler (void(*handler)(ocxl_err error, const char *message)) |
Override the default handler for emitting error messages from open calls. More... | |
const char * | ocxl_err_to_string (ocxl_err err) |
Convert an error value to a string. More... | |
These functions control messages from libocxl, such as error messages and tracing.
void ocxl_afu_enable_messages | ( | ocxl_afu_h | afu, |
uint64_t | sources | ||
) |
Enable messages from an AFU.
Error messages, if enabled, are emitted by default on STDERR. This behavior may be overridden by ocxl_afu_set_error_message_handler().
Tracing, if enabled, is always emitted on STDERR. It assists a developer by showing detailed AFU information, as well as MMIO & IRQ interactions between the application and the AFU. It does not show direct accesses to memory from the AFU.
afu | the AFU to enable message on |
sources | a bitwise OR of the message sources to enable (OCXL_ERRORS, OCXL_TRACING) |
void ocxl_afu_set_error_message_handler | ( | ocxl_afu_h | afu, |
void(*)(ocxl_afu_h afu, ocxl_err error, const char *message) | handler | ||
) |
Override the default handler for emitting error messages for an AFU.
The default error handler emits messages on STDERR, to override this behavior, pass a callback to this function.
The callback is responsible for prefixing and line termination.
Typical use cases would be redirecting error messages to the application's own logging/reporting mechanisms, and adding additional application-specific context to the error messages.
afu | the AFU to override the error handler for |
handler | the new error message handler |
void ocxl_enable_messages | ( | uint64_t | sources | ) |
Enable messages from libocxl open calls.
Error messages, if enabled, are emitted by default on STDERR. This behavior may be overridden by ocxl_afu_set_error_message_handler().
Tracing, if enabled, is always emitted on STDERR. It assists a developer by showing detailed AFU information.
sources | a bitwise OR of the message sources to enable (OCXL_ERRORS, OCXL_TRACING) |
const char* ocxl_err_to_string | ( | ocxl_err | err | ) |
Convert an error value to a string.
When implementing an error message handler, it may be useful to decode the provided ocxl_err to a human readable string, before logging the message.
err | the error value |
void ocxl_set_error_message_handler | ( | void(*)(ocxl_err error, const char *message) | handler | ) |
Override the default handler for emitting error messages from open calls.
The default error handler emits messages on STDERR, to override this behavior, pass a callback to this function.
The callback is responsible for prefixing and line termination.
Typical use cases would be redirecting error messages to the application's own logging/reporting mechanisms, and adding additional application-specific context to the error messages.
handler | the new error message handler |