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>
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);
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;
}
}
-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];
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;
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];
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;
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];
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);