File QnnLog.h

Parent directory (include/QNN)

Logging component API.

Definition (include/QNN/QnnLog.h)

Detailed Description

Provides means for QNN backends to output logging data.

Includes

Full File Listing

Logging component API.

    Provides means for QNN backends to output logging data.

Typedefs

typedef void (*QnnLog_Callback_t)(const char *fmt, QnnLog_Level_t level, uint64_t timestamp, va_list args)

Signature for user-supplied logging callback.

Param fmt

[in] Printf-style message format specifier.

Param level

[in] Log level for the message. Will not be higher than the maximum specified in QnnLog_create.

Param timestamp

[in] Backend-generated timestamp which is monotonically increasing, but otherwise meaningless.

Param args

[in] Message-specific parameters, to be used with fmt.

Warning

The backend may call this callback from multiple threads, and expects that it is re-entrant.

Enums

enum QnnLog_Error_t

QNN Log API result / error codes.

Values:

enumerator QNN_LOG_MIN_ERROR = 11000
enumerator QNN_LOG_NO_ERROR = 0

Qnn Log success.

enumerator QNN_LOG_ERROR_MEM_ALLOC = QNN_COMMON_ERROR_MEM_ALLOC

General error relating to memory allocation in Log API.

enumerator QNN_LOG_ERROR_INITIALIZATION = 11000 + 2

Unable to initialize logging.

enumerator QNN_LOG_ERROR_INVALID_ARGUMENT = 11000 + 3

Invalid argument passed.

enumerator QNN_LOG_ERROR_INVALID_HANDLE = 11000 + 4

Invalid log handle passed.

enumerator QNN_LOG_MAX_ERROR = 11999
enumerator QNN_LOG_ERROR_UNDEFINED = 0x7FFFFFFF
enum QnnLog_Level_t

Values:

enumerator QNN_LOG_LEVEL_ERROR = 1
enumerator QNN_LOG_LEVEL_WARN = 2
enumerator QNN_LOG_LEVEL_INFO = 3
enumerator QNN_LOG_LEVEL_VERBOSE = 4
enumerator QNN_LOG_LEVEL_DEBUG = 5

Reserved for developer debugging.

enumerator QNN_LOG_LEVEL_MAX = 0x7fffffff

Functions

Qnn_ErrorHandle_t QnnLog_create(QnnLog_Callback_t callback, QnnLog_Level_t maxLogLevel, Qnn_LogHandle_t *logger)

Create a handle to a logger object. This function can be called before QnnBackend_create().

Parameters
  • callback[in] Callback to handle backend-generated logging messages. NULL indicates backend may direct log messages to the default log stream on the target platform when possible (e.g. to logcat in case of Android).

  • maxLogLevel[in] Maximum level of messages which the backend will generate.

  • logger[out] The created log handle.

Returns

Error code:

  • QNN_SUCCESS: if logging is successfully initialized.

  • QNN_COMMON_ERROR_NOT_SUPPORTED: logging is not supported.

  • QNN_LOG_ERROR_INVALID_ARGUMENT: if one or more arguments is invalid.

  • QNN_LOG_ERROR_MEM_ALLOC: for memory allocation errors.

  • QNN_LOG_ERROR_INITIALIZATION: log init failed.

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION: SSR occurence (successful recovery)

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION_FATAL: SSR occurence (unsuccessful recovery)

Note

Use corresponding API through QnnInterface_t.

Warning

With different logging level enabled, the inference time may vary.

Qnn_ErrorHandle_t QnnLog_setLogLevel(Qnn_LogHandle_t logger, QnnLog_Level_t maxLogLevel)

A function to change the log level for the supplied log handle.

Parameters
  • logger[in] A log handle.

  • maxLogLevel[in] New maximum log level.

Returns

Error code:

  • QNN_SUCCESS: if the level is changed successfully.

  • QNN_LOG_ERROR_INVALID_ARGUMENT: if maxLogLevel is not a valid QnnLog_Level_t level.

  • QNN_LOG_ERROR_INVALID_HANDLE: logHandle is not a valid handle

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION: SSR occurence (successful recovery)

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION_FATAL: SSR occurence (unsuccessful recovery)

Note

Use corresponding API through QnnInterface_t.

Warning

With different logging level enabled, the inference time may vary.

Qnn_ErrorHandle_t QnnLog_free(Qnn_LogHandle_t logger)

A function to free the memory associated with the log handle.

Parameters

logger[in] A log handle.

Returns

Error code:

  • QNN_SUCCESS: indicates logging is terminated.

  • QNN_LOG_ERROR_MEM_ALLOC: for memory de-allocation errors.

  • QNN_LOG_ERROR_INVALID_HANDLE: logHandle is not a valid handle

Note

Use corresponding API through QnnInterface_t.