merge with master
[platform/framework/web/wrt.git] / src / wrt-launchpad-daemon / include / perf.h
index 35b0926..831e086 100644 (file)
@@ -14,7 +14,6 @@
  *    limitations under the License.
  */
 
-
 #ifndef __PERF_H__
 #define __PERF_H__
 
 
 #include <sys/time.h>
 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