From ad5a06f2969763059bb26399fa97569385074e01 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Mon, 31 Dec 2012 00:06:04 +0000 Subject: ACPICA: DEBUG_PRINT macros: Update to improve performance. Move check for "debug enable" to before the actual call to the debug print routine. Improves time of ASLTS by about 15%. Also, remove "safe" exit macros since no complex expressions are ever used in the return statements. Signed-off-by: Bob Moore Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- include/acpi/acoutput.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 38e1be094655..be014bf7efe5 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -263,16 +263,42 @@ * Common parameters used for debug output functions: * line number, function name, module(file) name, component ID */ -#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT +#define ACPI_DEBUG_PARAMETERS \ + __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT /* * Master debug print macros * Print message if and only if: * 1) Debug print for the current component is enabled * 2) Debug error level or trace level for the print statement is enabled + * + * November 2012: Moved the runtime check for whether to actually emit the + * debug message outside of the print function itself. This improves overall + * performance at a relatively small code cost. Implementation involves the + * use of variadic macros supported by C99. */ -#define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist -#define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist + +/* DEBUG_PRINT functions */ + +#define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist +#define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist + +/* Helper macros for DEBUG_PRINT */ + +#define ACPI_IS_DEBUG_ENABLED(level, component) \ + (level & acpi_dbg_level) && (component & acpi_dbg_layer) + +#define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \ + if (ACPI_IS_DEBUG_ENABLED (level, component)) \ + { \ + function (level, line, filename, modulename, component, __VA_ARGS__); \ + } + +#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \ + ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename, component, __VA_ARGS__) + +#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ + ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename, component, __VA_ARGS__) #else /* -- cgit v1.2.3