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 b871522..c0f98ef 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 feedd7f..56913ae 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 4e89894..53c5882 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 05771cb..eea34dc 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 926f3a0..f24a6b5 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);