Use the following functions to activate, deactivate and read information about the trace modules.
This function activates a trace module. Trace messages to modules which are not activated will not be written to the trace buffer. This means, that you have to activate a module to trace its messages. Available Module names can be retrieved with the function mlpiTraceGetModuleList. It is highly recommended to use the macro MLPI_TRACE_MODULE_USER for your code.
- Note
- Enabling trace modules might cost some CPU performance.
- Parameters
-
[in] | connection | Handle for multiple connections. |
[out] | moduleName | Pointer to module name string. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // Activate only the module 'MLPI_TRACE_MODULE_USER'
2 MLPIRESULT result = mlpiTraceActivateModule(connection, MLPI_TRACE_MODULE_USER);
3 if (MLPI_FAILED(result)) {
4 printf("\ncall of MLPI function failed with 0x%08x!", result);
This function deactivates a trace module. Messages to a deactivated trace module are ignored by the tracing system and thus will not appear in the trace buffer. Available Module names can be retrieved with the function mlpiTraceGetModuleList.
- Parameters
-
[in] | connection | Handle for multiple connections. |
[out] | moduleName | Pointer to module name string. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // Deactivate only the module 'MLPI_TRACE_MODULE_USER'
2 MLPIRESULT result = mlpiTraceDeactivateModule(connection, MLPI_TRACE_MODULE_USER);
3 if (MLPI_FAILED(result)) {
4 printf("\ncall of MLPI function failed with 0x%08x!", result);
This function activates all available trace modules.
- Note
- Enabling all trace modules might result in a performance drop, as tracing costs CPU time. It is not recommended to enable all trace modules on a productive machine. Try activating only the modules of interest, or one module at a time.
- Parameters
-
[in] | connection | Handle for multiple connections. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // activate all available trace modules (not recommended!)
2 MLPIRESULT result = mlpiTraceActivateAllModules(connection);
3 if (MLPI_FAILED(result)) {
4 printf("\ncall of MLPI function failed with 0x%08x!", result);
This function deactivates all available trace modules.
- Parameters
-
[in] | connection | Handle for multiple connections. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
1 // activate all available trace modules
2 MLPIRESULT result = mlpiTraceDeactivateAllModules(connection);
3 if (MLPI_FAILED(result)) {
4 printf("\ncall of MLPI function failed with 0x%08x!", result);
This function returns the number of registered modules.
- Parameters
-
[in] | connection | Handle for multiple connections. |
[out] | numberOfModules | Number of registered modules. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
2 MLPIRESULT result = mlpiTraceGetNumberOfModules(connection, &numModules);
3 if (MLPI_FAILED(result)) {
4 printf("\ncall of MLPI function failed with 0x%08x!", result);
8 printf("\nNumber of available trace modules: %d", numModules);
This function returns a list of all modules currently available in the tracing system. The module information also contains the name of each module. This name can be used with other calls to the tracing system.
- Parameters
-
[in] | connection | Handle for multiple connections. |
[out] | moduleInfo | Pointer to an array which will receive the module information. One element for each module. |
[in] | numElements | Array size of buffer given to function in number of elements. |
[out] | numElementsRet | Returns the actual number of elements returned. |
- Returns
- Return value indicating success (>=0) or error (<0).
- Example:
2 MlpiTraceModuleInformation modules[MLPI_TRACE_MAX_MODULES];
4 // read array of available modules
5 MLPIRESULT result = mlpiTraceGetModuleList(connection, modules, _countof(modules), &numModules);
6 if (MLPI_FAILED(result)) {
7 printf("\ncall of MLPI function failed with 0x%08x!", result);
11 // print all modules found
12 printf("\nFound %d Modules\n", numModules);
13 printf("\n ModuleName | Active | StdOut | Main | Separat| Buffer ");
14 printf("\n---------------------+--------+--------+--------+--------+-------- ");
15 for (ULONG i=0; i<numModules; i++)
17 printf("\n%20S", modules[i].moduleName);
18 printf(" |%7s", (modules[i].isActive) ? "TRUE" : "FALSE");
19 printf(" |%7s", (modules[i].toStdOut) ? "TRUE" : "FALSE");
20 printf(" |%7s", (modules[i].toMainBuffer) ? "TRUE" : "FALSE");
21 printf(" |%7s", (modules[i].toSeparateBuffer) ? "TRUE" : "FALSE");
22 printf(" | %s", W2A16(modules[i].bufferName));