summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2013-09-18 17:21:34 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-24 17:16:53 +0200
commitf1d86b61fb6692c592e937dfb5069e4057855a3b (patch)
treeebf8feb3c5067a774492f9b52a87446e8d32853f
parents390/bitops: optimize set_bit() for constant values (diff)
downloadlinux-f1d86b61fb6692c592e937dfb5069e4057855a3b.tar.xz
linux-f1d86b61fb6692c592e937dfb5069e4057855a3b.zip
s390/s390dbf: add debug_level_enabled() function
Add the debug_level_enabled() function to check if debug events for a particular level would be logged. This might help to save cycles for debug events that require additional information collection. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--Documentation/s390/s390dbf.txt10
-rw-r--r--arch/s390/include/asm/debug.h5
2 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/s390/s390dbf.txt b/Documentation/s390/s390dbf.txt
index fcaf0b4efba2..3da163383c93 100644
--- a/Documentation/s390/s390dbf.txt
+++ b/Documentation/s390/s390dbf.txt
@@ -158,6 +158,16 @@ Return Value: none
Description: Sets new actual debug level if new_level is valid.
---------------------------------------------------------------------------
+bool debug_level_enabled (debug_info_t * id, int level);
+
+Parameter: id: handle for debug log
+ level: debug level
+
+Return Value: True if level is less or equal to the current debug level.
+
+Description: Returns true if debug events for the specified level would be
+ logged. Otherwise returns false.
+---------------------------------------------------------------------------
void debug_stop_all(void);
Parameter: none
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
index 188c5052a20a..530c15eb01e9 100644
--- a/arch/s390/include/asm/debug.h
+++ b/arch/s390/include/asm/debug.h
@@ -107,6 +107,11 @@ void debug_set_level(debug_info_t* id, int new_level);
void debug_set_critical(void);
void debug_stop_all(void);
+static inline bool debug_level_enabled(debug_info_t* id, int level)
+{
+ return level <= id->level;
+}
+
static inline debug_entry_t*
debug_event(debug_info_t* id, int level, void* data, int length)
{