X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fwrt-launchpad-daemon%2Finclude%2Fperf.h;h=831e08623fd3f6b2e38caa0bfc5adc27e5bd0c62;hb=6265c7906bdc99ce34da0d179b52a66394db77b9;hp=35b092640f92e00a0e450605dc27de8136651045;hpb=edbd1780527cdad56100bc1bf5b553f9e3f83035;p=platform%2Fframework%2Fweb%2Fwrt.git diff --git a/src/wrt-launchpad-daemon/include/perf.h b/src/wrt-launchpad-daemon/include/perf.h index 35b0926..831e086 100644 --- a/src/wrt-launchpad-daemon/include/perf.h +++ b/src/wrt-launchpad-daemon/include/perf.h @@ -14,7 +14,6 @@ * limitations under the License. */ - #ifndef __PERF_H__ #define __PERF_H__ @@ -22,40 +21,40 @@ #include static struct timeval __g_base_time = { - .tv_sec = 0, - .tv_usec = 0 + .tv_sec = 0, + .tv_usec = 0 }; -#define INIT_PERF(kb)\ -do {\ - const char *tmp;\ - struct timeval tv;\ - tmp = bundle_get_val(kb, AUL_K_STARTTIME);\ - if (tmp != NULL)\ - sscanf(tmp, "%ld/%ld", &tv.tv_sec, &tv.tv_usec);\ - else\ - gettimeofday(&tv, NULL);\ - __g_base_time.tv_sec = tv.tv_sec;\ - __g_base_time.tv_usec = tv.tv_usec;\ -} while (0); - -#define PERF(fmt, arg...)\ -do {\ - struct timeval cur;\ - struct timeval res;\ - gettimeofday(&cur, NULL);\ - if (__g_base_time.tv_sec != 0) {\ - timersub(&cur, &__g_base_time, &res);\ - printf("%c[1;31m[%s,%d] %ld sec %ld msec "fmt" %c[0m\n",\ - 27, __FUNCTION__, __LINE__, \ - res.tv_sec, res.tv_usec/1000, ##arg, 27);\ - } \ -} while (0); +#define INIT_PERF(kb) \ + do { \ + const char *tmp; \ + struct timeval tv; \ + tmp = bundle_get_val(kb, AUL_K_STARTTIME); \ + if (tmp != NULL) { \ + sscanf(tmp, "%ld/%ld", &tv.tv_sec, &tv.tv_usec); } \ + else { \ + gettimeofday(&tv, NULL); } \ + __g_base_time.tv_sec = tv.tv_sec; \ + __g_base_time.tv_usec = tv.tv_usec; \ + } while (0); + +#define PERF(fmt, arg ...) \ + do { \ + struct timeval cur; \ + struct timeval res; \ + gettimeofday(&cur, NULL); \ + if (__g_base_time.tv_sec != 0) { \ + timersub(&cur, &__g_base_time, &res); \ + printf("%c[1;31m[%s,%d] %ld sec %ld msec "fmt " %c[0m\n", \ + 27, __FUNCTION__, __LINE__, \ + res.tv_sec, res.tv_usec / 1000,##arg, 27); \ + } \ + } while (0); #else #define INIT_PERF(kb) -#define PERF(fmt, arg...) +#define PERF(fmt, arg ...) #endif