1
0
Fork 0

ACPICA: FUNCTION_TRACE macros: Check if debug is enabled up-front.

In the functions that implement the macros, check if debug
is enabled up-front before the call to the lower debug print
function. This provides a small performance improvement.

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>
hifive-unleashed-5.1
Bob Moore 2012-12-31 00:06:10 +00:00 committed by Rafael J. Wysocki
parent ad5a06f296
commit db38bf5a57
1 changed files with 78 additions and 40 deletions

View File

@ -166,11 +166,9 @@ acpi_debug_print(u32 requested_debug_level,
acpi_thread_id thread_id; acpi_thread_id thread_id;
va_list args; va_list args;
/* /* Check if debug output enabled */
* Stay silent if the debug level or component ID is disabled
*/ if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
if (!(requested_debug_level & acpi_dbg_level) ||
!(component_id & acpi_dbg_layer)) {
return; return;
} }
@ -236,8 +234,9 @@ acpi_debug_print_raw(u32 requested_debug_level,
{ {
va_list args; va_list args;
if (!(requested_debug_level & acpi_dbg_level) || /* Check if debug output enabled */
!(component_id & acpi_dbg_layer)) {
if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
return; return;
} }
@ -272,9 +271,13 @@ acpi_ut_trace(u32 line_number,
acpi_gbl_nesting_level++; acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr(); acpi_ut_track_stack_ptr();
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s\n", acpi_gbl_fn_entry_str); if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s\n", acpi_gbl_fn_entry_str);
}
} }
ACPI_EXPORT_SYMBOL(acpi_ut_trace) ACPI_EXPORT_SYMBOL(acpi_ut_trace)
@ -304,9 +307,14 @@ acpi_ut_trace_ptr(u32 line_number,
acpi_gbl_nesting_level++; acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr(); acpi_ut_track_stack_ptr();
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s %p\n", acpi_gbl_fn_entry_str, pointer); if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %p\n", acpi_gbl_fn_entry_str,
pointer);
}
} }
/******************************************************************************* /*******************************************************************************
@ -335,9 +343,14 @@ acpi_ut_trace_str(u32 line_number,
acpi_gbl_nesting_level++; acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr(); acpi_ut_track_stack_ptr();
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s %s\n", acpi_gbl_fn_entry_str, string); if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %s\n", acpi_gbl_fn_entry_str,
string);
}
} }
/******************************************************************************* /*******************************************************************************
@ -366,9 +379,14 @@ acpi_ut_trace_u32(u32 line_number,
acpi_gbl_nesting_level++; acpi_gbl_nesting_level++;
acpi_ut_track_stack_ptr(); acpi_ut_track_stack_ptr();
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s %08X\n", acpi_gbl_fn_entry_str, integer); if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %08X\n",
acpi_gbl_fn_entry_str, integer);
}
} }
/******************************************************************************* /*******************************************************************************
@ -393,9 +411,13 @@ acpi_ut_exit(u32 line_number,
const char *module_name, u32 component_id) const char *module_name, u32 component_id)
{ {
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s\n", acpi_gbl_fn_exit_str); if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s\n", acpi_gbl_fn_exit_str);
}
acpi_gbl_nesting_level--; acpi_gbl_nesting_level--;
} }
@ -425,17 +447,23 @@ acpi_ut_status_exit(u32 line_number,
u32 component_id, acpi_status status) u32 component_id, acpi_status status)
{ {
if (ACPI_SUCCESS(status)) { /* Check if enabled up-front for performance */
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name, if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
component_id, "%s %s\n", acpi_gbl_fn_exit_str, if (ACPI_SUCCESS(status)) {
acpi_format_exception(status)); acpi_debug_print(ACPI_LV_FUNCTIONS,
} else { line_number, function_name,
acpi_debug_print(ACPI_LV_FUNCTIONS, module_name, component_id, "%s %s\n",
line_number, function_name, module_name, acpi_gbl_fn_exit_str,
component_id, "%s ****Exception****: %s\n", acpi_format_exception(status));
acpi_gbl_fn_exit_str, } else {
acpi_format_exception(status)); acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name,
module_name, component_id,
"%s ****Exception****: %s\n",
acpi_gbl_fn_exit_str,
acpi_format_exception(status));
}
} }
acpi_gbl_nesting_level--; acpi_gbl_nesting_level--;
@ -465,10 +493,15 @@ acpi_ut_value_exit(u32 line_number,
const char *module_name, u32 component_id, u64 value) const char *module_name, u32 component_id, u64 value)
{ {
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
ACPI_FORMAT_UINT64(value)); acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %8.8X%8.8X\n",
acpi_gbl_fn_exit_str,
ACPI_FORMAT_UINT64(value));
}
acpi_gbl_nesting_level--; acpi_gbl_nesting_level--;
} }
@ -497,9 +530,14 @@ acpi_ut_ptr_exit(u32 line_number,
const char *module_name, u32 component_id, u8 *ptr) const char *module_name, u32 component_id, u8 *ptr)
{ {
acpi_debug_print(ACPI_LV_FUNCTIONS, /* Check if enabled up-front for performance */
line_number, function_name, module_name, component_id,
"%s %p\n", acpi_gbl_fn_exit_str, ptr); if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %p\n", acpi_gbl_fn_exit_str,
ptr);
}
acpi_gbl_nesting_level--; acpi_gbl_nesting_level--;
} }