From 03e9ce18b9806dc9946c3d6b19d10ee8abebbe29 Mon Sep 17 00:00:00 2001 From: Dean Jenkins Date: Fri, 16 Mar 2012 15:53:41 +0530 Subject: [PATCH] dbus: add timestamps to dbus-monitor logs Source: MontaVista Software, LLC MR: 49859 Type: Enhancement Disposition: Local Description: D-bus logs from IVI are difficult or impossible to fully analyse because these logs do not have timestamps. Therefore enhance the dbus-monitor to add timestamps to the D-bus log output. Since there is no separate printf format for time_t use 'long unsigned' format to match long int size anywhere and to have the same format as kernel messages timestamps. Signed-off-by: Dean Jenkins Signed-off-by: Dushyanth SR Signed-off-by: Vitaly Kuzmichev Signed-off-by: Peter Demus --- tools/dbus-print-message.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index 75d00ac..113230a 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -26,6 +26,8 @@ #include #include "config.h" +#include + static const char* type_to_name (int message_type) { @@ -368,6 +370,12 @@ print_message (DBusMessage *message, dbus_bool_t literal) if (!literal) { + struct timespec timestamp; + + /* get the current time and use it a timestamp */ + clock_gettime(CLOCK_MONOTONIC, ×tamp); + printf ("[%5lu.%06lu] ", (unsigned long) timestamp.tv_sec, + timestamp.tv_nsec/1000); printf ("%s sender=%s -> dest=%s", type_to_name (message_type), sender ? sender : "(null sender)", -- 1.7.5.4