From 6e89d787cf65d6a1e98561ad5d8f9f57eb6f5727 Mon Sep 17 00:00:00 2001 From: amrutjoshi Date: Tue, 3 Jun 2003 13:08:16 +0000 Subject: [PATCH] 1) changed debug mesg format. 2) changed llanalyze parser to parse new format 3) changed llanalyze to show different colors for entry and exit. 4) give log filename as 1st arg to llanalyze e.g. "llanalyze FILENALE". 5) give console column width as 2nd arg to llanalyze so that the output doesnt wrap around. --- lnet/include/linux/kp30.h | 2 +- lnet/libcfs/debug.c | 33 ++++++++++++++++----------------- lustre/portals/include/linux/kp30.h | 2 +- lustre/portals/libcfs/debug.c | 33 ++++++++++++++++----------------- 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 6611e99..64fdb1c 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -575,7 +575,7 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len); # undef printf #endif void portals_debug_msg(int subsys, int mask, char *file, const char *fn, - const int line, unsigned long stack, const char *format, + const int line, unsigned long stack, char *format, ...) __attribute__ ((format (printf, 7, 8))); #else diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index 0af515e..da54026 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -665,7 +665,7 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void portals_debug_msg (int subsys, int mask, char *file, const char *fn, - const int line, unsigned long stack, const char *format, ...) + const int line, unsigned long stack, char *format, ...) { va_list ap; unsigned long flags; @@ -720,34 +720,33 @@ portals_debug_msg (int subsys, int mask, char *file, const char *fn, do_gettimeofday(&tv); prefix_nob = snprintf(debug_buf + debug_off, max_nob, - "%02x:%06x:%d:%lu.%06lu ", + "%02x:%06x:%d:%lu.%06lu :", subsys >> 24, mask, smp_processor_id(), tv.tv_sec, tv.tv_usec); max_nob -= prefix_nob; - + if(*(format + strlen(format) - 1) == '\n') + *(format + strlen(format) - 1) = ':'; + + va_start(ap, format); + msg_nob = vsnprintf(debug_buf + debug_off + prefix_nob , + max_nob, format, ap); + max_nob -= msg_nob; + va_end(ap); #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) - msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, - "(%s:%d:%s() %d | %d+%lu): ", + msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob, + "(%s:%d:%s() %d | %d+%lu)\n", file, line, fn, current->pid, current->thread.extern_pid, stack); #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, - "(%s:%d:%s() %d | %d+%lu): ", + msg_nob += snprintf(debug_buf + debug_off + prefix_nob+ msg_nob, max_nob, + "(%s:%d:%s() %d | %d+%lu)\n", file, line, fn, current->pid, current->thread.mode.tt.extern_pid, stack); #else - msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, - "(%s:%d:%s() %d+%lu): ", + msg_nob += snprintf(debug_buf + debug_off + prefix_nob+ msg_nob, max_nob, + "(%s:%d:%s() %d+%lu)\n", file, line, fn, current->pid, stack); #endif - max_nob -= msg_nob; - - va_start(ap, format); - msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob, - max_nob, format, ap); - max_nob -= msg_nob; - va_end(ap); - /* Print to console, while msg is contiguous in debug_buf */ /* NB safely terminated see above */ if ((mask & D_EMERG) != 0) diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 6611e99..64fdb1c 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -575,7 +575,7 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len); # undef printf #endif void portals_debug_msg(int subsys, int mask, char *file, const char *fn, - const int line, unsigned long stack, const char *format, + const int line, unsigned long stack, char *format, ...) __attribute__ ((format (printf, 7, 8))); #else diff --git a/lustre/portals/libcfs/debug.c b/lustre/portals/libcfs/debug.c index 0af515e..da54026 100644 --- a/lustre/portals/libcfs/debug.c +++ b/lustre/portals/libcfs/debug.c @@ -665,7 +665,7 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len) /* FIXME: I'm not very smart; someone smarter should make this better. */ void portals_debug_msg (int subsys, int mask, char *file, const char *fn, - const int line, unsigned long stack, const char *format, ...) + const int line, unsigned long stack, char *format, ...) { va_list ap; unsigned long flags; @@ -720,34 +720,33 @@ portals_debug_msg (int subsys, int mask, char *file, const char *fn, do_gettimeofday(&tv); prefix_nob = snprintf(debug_buf + debug_off, max_nob, - "%02x:%06x:%d:%lu.%06lu ", + "%02x:%06x:%d:%lu.%06lu :", subsys >> 24, mask, smp_processor_id(), tv.tv_sec, tv.tv_usec); max_nob -= prefix_nob; - + if(*(format + strlen(format) - 1) == '\n') + *(format + strlen(format) - 1) = ':'; + + va_start(ap, format); + msg_nob = vsnprintf(debug_buf + debug_off + prefix_nob , + max_nob, format, ap); + max_nob -= msg_nob; + va_end(ap); #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) - msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, - "(%s:%d:%s() %d | %d+%lu): ", + msg_nob += snprintf(debug_buf + debug_off + prefix_nob + msg_nob, max_nob, + "(%s:%d:%s() %d | %d+%lu)\n", file, line, fn, current->pid, current->thread.extern_pid, stack); #elif defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, - "(%s:%d:%s() %d | %d+%lu): ", + msg_nob += snprintf(debug_buf + debug_off + prefix_nob+ msg_nob, max_nob, + "(%s:%d:%s() %d | %d+%lu)\n", file, line, fn, current->pid, current->thread.mode.tt.extern_pid, stack); #else - msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, - "(%s:%d:%s() %d+%lu): ", + msg_nob += snprintf(debug_buf + debug_off + prefix_nob+ msg_nob, max_nob, + "(%s:%d:%s() %d+%lu)\n", file, line, fn, current->pid, stack); #endif - max_nob -= msg_nob; - - va_start(ap, format); - msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob, - max_nob, format, ap); - max_nob -= msg_nob; - va_end(ap); - /* Print to console, while msg is contiguous in debug_buf */ /* NB safely terminated see above */ if ((mask & D_EMERG) != 0) -- 1.8.3.1