diff options
author | Bob Moore <robert.moore@intel.com> | 2012-12-30 19:06:04 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-10 06:36:20 -0500 |
commit | ad5a06f2969763059bb26399fa97569385074e01 (patch) | |
tree | 604d9954457d47cd607e97d0da6de851ece519ee /include/acpi | |
parent | 0fdce47677be8d86408d2beef6fda3dc4c7edf56 (diff) |
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 <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/acoutput.h | 32 |
1 files changed, 29 insertions, 3 deletions
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 @@ | |||
263 | * Common parameters used for debug output functions: | 263 | * Common parameters used for debug output functions: |
264 | * line number, function name, module(file) name, component ID | 264 | * line number, function name, module(file) name, component ID |
265 | */ | 265 | */ |
266 | #define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT | 266 | #define ACPI_DEBUG_PARAMETERS \ |
267 | __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT | ||
267 | 268 | ||
268 | /* | 269 | /* |
269 | * Master debug print macros | 270 | * Master debug print macros |
270 | * Print message if and only if: | 271 | * Print message if and only if: |
271 | * 1) Debug print for the current component is enabled | 272 | * 1) Debug print for the current component is enabled |
272 | * 2) Debug error level or trace level for the print statement is enabled | 273 | * 2) Debug error level or trace level for the print statement is enabled |
274 | * | ||
275 | * November 2012: Moved the runtime check for whether to actually emit the | ||
276 | * debug message outside of the print function itself. This improves overall | ||
277 | * performance at a relatively small code cost. Implementation involves the | ||
278 | * use of variadic macros supported by C99. | ||
273 | */ | 279 | */ |
274 | #define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist | 280 | |
275 | #define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist | 281 | /* DEBUG_PRINT functions */ |
282 | |||
283 | #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist | ||
284 | #define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist | ||
285 | |||
286 | /* Helper macros for DEBUG_PRINT */ | ||
287 | |||
288 | #define ACPI_IS_DEBUG_ENABLED(level, component) \ | ||
289 | (level & acpi_dbg_level) && (component & acpi_dbg_layer) | ||
290 | |||
291 | #define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \ | ||
292 | if (ACPI_IS_DEBUG_ENABLED (level, component)) \ | ||
293 | { \ | ||
294 | function (level, line, filename, modulename, component, __VA_ARGS__); \ | ||
295 | } | ||
296 | |||
297 | #define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \ | ||
298 | ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename, component, __VA_ARGS__) | ||
299 | |||
300 | #define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ | ||
301 | ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename, component, __VA_ARGS__) | ||
276 | 302 | ||
277 | #else | 303 | #else |
278 | /* | 304 | /* |