summaryrefslogtreecommitdiff
path: root/include/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2012-12-31 00:06:04 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-10 12:36:20 +0100
commitad5a06f2969763059bb26399fa97569385074e01 (patch)
tree604d9954457d47cd607e97d0da6de851ece519ee /include/acpi
parent0fdce47677be8d86408d2beef6fda3dc4c7edf56 (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.h32
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 @@
* 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
/*