log: modify some emulator.log formats. 69/25569/1
authorSooyoung Ha <yoosah.ha@samsung.com>
Thu, 31 Jul 2014 07:49:00 +0000 (16:49 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 7 Aug 2014 05:45:10 +0000 (14:45 +0900)
add the microsecond time to output format.
add the thread id to output format.

Change-Id: I23247dfdd76481b9f8bd21a6000aa835459ed8ad
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
tizen/src/util/new_debug_ch.c
tizen/src/util/osutil-darwin.c
tizen/src/util/osutil-linux.c
tizen/src/util/osutil-win32.c
tizen/src/util/osutil.h

index b871522e71c9d8a43081b35c76d77ce161fe9a2c..c0f98efb173ec0bed45e7fa1a3b008248a17edd1 100644 (file)
@@ -297,8 +297,9 @@ int dbg_log(enum _debug_class cls, struct _debug_channel *channel,
         return -1;
     }
 
-    ret = g_snprintf(buf_msg, sizeof(buf_msg), "%s [%s:%s] ",
-            get_timeofday(), debug_classes[cls], channel->name);
+    ret += get_timeofday(buf_msg, sizeof(buf_msg));
+    ret += g_snprintf(buf_msg + ret, sizeof(buf_msg) - ret, "(%5d) [%s:%s] ",
+                qemu_get_thread_id(), debug_classes[cls], channel->name);
 
     va_start(valist, format);
     ret += g_vsnprintf(buf_msg + ret, sizeof(buf_msg) - ret, format, valist);
index feedd7fbe44835d0dc2bb3515b18e0591a350c45..56913ae436fcda35c2bedc8b644f39ff5a4c5e29 100644 (file)
 
 MULTI_DEBUG_CHANNEL(qemu, osutil);
 
-
-static qemu_timeval tv = { 0, 0 };
-static time_t ti;
-static char buf_time[64];
 static int g_shmid;
 static CFDictionaryRef proxySettings;
 
@@ -238,19 +234,6 @@ void print_system_info_os(void)
     }
 }
 
-char *get_timeofday(void)
-{
-    qemu_gettimeofday(&tv);
-    ti = tv.tv_sec;
-
-    struct tm tm;
-    localtime_r(&ti, &tm);
-    strftime(buf_time, sizeof(buf_time),
-             "%H:%M:%S", &tm);
-
-    return buf_time;
-}
-
 static int get_auto_proxy(char *http_proxy, char *https_proxy, char *ftp_proxy, char *socks_proxy)
 {
     char type[DEFAULTBUFLEN];
index 4e898941cd2791e8f07645eb7ea71def362b6f08..53c5882276341dbeec2799acb778800cf67db5b3 100644 (file)
 
 MULTI_DEBUG_CHANNEL(emulator, osutil);
 
-
-static qemu_timeval tv = { 0, 0 };
-static time_t ti;
-static char buf_time[64];
-
 static int g_shmid;
 static char *g_shared_memory;
 static int gproxytool = GSETTINGS;
@@ -254,19 +249,6 @@ void print_system_info_os(void)
     g_free(buffer);
 }
 
-char *get_timeofday(void)
-{
-    qemu_gettimeofday(&tv);
-    ti = tv.tv_sec;
-
-    struct tm tm;
-    localtime_r(&ti, &tm);
-    strftime(buf_time, sizeof(buf_time),
-             "%H:%M:%S", &tm);
-
-    return buf_time;
-}
-
 static void process_string(char *buf)
 {
     char tmp_buf[DEFAULTBUFLEN];
index 05771cbf4912a1949539d86911ab42a02d5b21ed..eea34dc945362f60f244695ed21f8621f6041428 100644 (file)
 
 MULTI_DEBUG_CHANNEL (emulator, osutil);
 
-
-static qemu_timeval tv = { 0, 0 };
-static time_t ti;
-static char buf_time[64];
 static HANDLE g_hMapFile;
 static char *g_pBuf;
 
@@ -212,18 +208,6 @@ void print_system_info_os(void)
             memInfo.ullTotalPhys / 1024, memInfo.ullAvailPhys / 1024);
 }
 
-char *get_timeofday(void)
-{
-    qemu_gettimeofday(&tv);
-    ti = tv.tv_sec;
-
-    struct tm *ptm = localtime(&ti);
-    strftime(buf_time, sizeof(buf_time),
-             "%H:%M:%S", ptm);
-
-    return buf_time;
-}
-
 static int get_auto_proxy(BYTE *url, char *http_proxy, char *https_proxy, char *ftp_proxy, char *socks_proxy)
 {
     char type[DEFAULTBUFLEN];
index 926f3a0a374997a44c585661a865ee7c8334fe4c..f24a6b561fab0dd43a0b022fd29a85357b5af500 100644 (file)
@@ -73,7 +73,26 @@ void get_host_proxy_os(char *, char *, char *, char *);
 void download_url(char *);
 size_t write_data(void *, size_t, size_t, FILE *);
 void remove_string(char *, char *, const char *);
-char *get_timeofday(void);
+
+static inline int get_timeofday(char *buf, size_t size)
+{
+    qemu_timeval tv;
+    time_t ti;
+    struct tm *ptm = NULL;
+    int ret;
+
+    qemu_gettimeofday(&tv);
+    ti = tv.tv_sec;
+
+#ifndef CONFIG_WIN32
+    localtime_r(&ti, ptm);
+#else
+    ptm = localtime(&ti);
+#endif
+    ret = strftime(buf, size, "%H:%M:%S", ptm);
+
+    return ret + g_snprintf(buf + ret, size - ret, ".%06ld", tv.tv_usec);
+}
 
 int get_number_of_processors(void);