summaryrefslogtreecommitdiff
path: root/common/include/ivug-debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/include/ivug-debug.h')
-rwxr-xr-xcommon/include/ivug-debug.h108
1 files changed, 84 insertions, 24 deletions
diff --git a/common/include/ivug-debug.h b/common/include/ivug-debug.h
index fae7537..94621ce 100755
--- a/common/include/ivug-debug.h
+++ b/common/include/ivug-debug.h
@@ -1,27 +1,57 @@
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef _IVUG_DEBUG_H_
#define _IVUG_DEBUG_H_
#include <dlog.h>
+#include "statistics.h"
#define IVUG_LOG_OUTPUT_DLOG
+#define PERF_TIME
+
+#define LVL0 (0)
+#define LVL1 (1)
+#define LVL2 (2)
+#define LVL3 (3)
+#define LVL4 (4)
+#define LVL5 (5)
+#define LVL6 (6)
+#define LVL7 (7)
+
+#ifdef PERF_TIME
+
+// accum item handling
+#define PERF_CHECK_BEGIN(lvl, name) iv_ta_accum_item_begin(lvl, name,false,__FILE__,__LINE__)
+#define PERF_CHECK_END(lvl, name) iv_ta_accum_item_end(lvl, name,false,__FILE__,__LINE__)
+
+// Print out
+#define PERF_SHOW_RESULT(fp) iv_ta_accum_show_result_fp(fp)
+
+#else
+
+#define PERF_CHECK_BEGIN(lvl, name)
+#define PERF_CHECK_END(lvl, name)
+
+// Print out
+#define PERF_SHOW_RESULT(fp)
+
+#endif // PERF_TIME
+
enum {
IVUG_MSG_COLOR_DEFAULT = 0,
IVUG_MSG_COLOR_BLACK = 30,
@@ -34,6 +64,7 @@ enum {
IVUG_MSG_COLOR_WHITE = 37,
};
+
#ifdef IVUG_LOG_OUTPUT_DLOG
#undef LOG_TAG
@@ -48,8 +79,8 @@ enum {
#define IVUG_DEBUG_MSG(fmt, arg...) fprintf(stdout, "[D: %s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
#define IVUG_DEBUG_WARNING(fmt, arg...) fprintf(stdout, "[W: %s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
#define IVUG_DEBUG_ERROR(fmt, arg...) fprintf(stdout, "[E: %s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
-#define IVUG_DEBUG_CRITICAL(fmt, arg...) fprintf(stdout, "[E: %s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
-#define IVUG_DEBUG_PRINT(fmt,arg...) fprintf(stdout, "[%s : %05d] >>> leave \n", __func__, __LINE__ , ##arg)
+#define IVUG_DEBUG_CRITICAL(fmt, arg...) fprintf(stdout, "[E: %s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
+#define IVUG_DEBUG_PRINT(fmt,arg...) fprintf(stdout, "[%s : %05d] >>> leave \n", __func__, __LINE__ , ##arg)
#endif //IVUG_LOG_OUTPUT_DLOG
@@ -204,18 +235,29 @@ enum {
#define MSG_SLIST_MED(...) __MSG_MED(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
#define MSG_SLIST_LOW(...) __MSG_LOW(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
-
#define IV_ASSERT(expr) ASSERT(DBG_MSG_LVL_ALL, "IV-COMMON", expr)
+#define MSG_ASSERT(expr) ASSERT(DBG_MSG_LVL_ALL, LOG_CAT, expr)
+
+#define MSG_FATAL(...) __MSG_FATAL(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+#define MSG_WARN(...) __MSG_ERROR(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+#define MSG_ERROR(...) __MSG_WARN(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+#define MSG_HIGH(...) __MSG_HIGH(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+#define MSG_MED(...) __MSG_MED(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+#define MSG_LOW(...) __MSG_LOW(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+#define MSG_DEBUG(...) __MSG_DBG(LOG_LVL, LOG_CAT, ##__VA_ARGS__)
+
+//expr check statements.
+// Will deprecated
#define IVUG_FUNC_ENTER() MSG_IVUG_HIGH("ENTER %s(L%d)", __func__, __LINE__)
#define IVUG_FUNC_LEAVE() MSG_IVUG_HIGH("LEAVE %s(L%d)", __func__, __LINE__)
-//expr check statements
+
#define ivug_ret_if(expr) \
do { \
if(expr) { \
- MSG_IMAGEVIEW_WARN("[%s] Return", #expr );\
+ MSG_IVUG_ERROR("[%s] Return", #expr );\
return; \
} \
} while (0)
@@ -223,7 +265,7 @@ enum {
#define ivug_retv_if(expr, val) \
do { \
if(expr) { \
- MSG_IMAGEVIEW_WARN("[%s] Return value %d", #expr, val );\
+ MSG_IVUG_ERROR("[%s] Return value %d", #expr, val );\
return (val); \
} \
} while (0)
@@ -231,7 +273,7 @@ enum {
#define ivug_retm_if(expr, fmt, args...) \
do { \
if(expr) { \
- MSG_IMAGEVIEW_WARN("[%s] Return, message "fmt, #expr, ##args );\
+ MSG_IVUG_ERROR("[%s] Return, message "fmt, #expr, ##args );\
return; \
} \
} while (0)
@@ -239,12 +281,30 @@ enum {
#define ivug_retvm_if(expr, val, fmt, args...) \
do { \
if(expr) { \
- MSG_IMAGEVIEW_WARN("[%s] Return value, message "fmt, #expr, ##args );\
+ MSG_IVUG_ERROR("[%s] Return value, message "fmt, #expr, ##args );\
return (val); \
} \
} while (0)
+// Use this instead of ivug_ret_if
+
+#define IV_RET_IF(expr, fmt, args...) \
+ do { \
+ if(expr) { \
+ MSG_IVUG_FATAL("[%s] Return, message "fmt, #expr, ##args );\
+ return; \
+ } \
+ } while (0)
+
+#define IV_RETV_IF(expr, val, fmt, args...) \
+ do { \
+ if(expr) { \
+ MSG_IVUG_FATAL("[%s] Return value, message "fmt, #expr, ##args );\
+ return (val); \
+ } \
+ } while (0)
+
#include "debug.h"