4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 * Common macros for tracing
26 #ifndef _SYSTEM_RESOURCE_TRACE_H_
27 #define _SYSTEM_RESOURCE_TRACE_H_
36 #define LOG_TAG "RESOURCED"
38 #define WALK_TREE(list, func) g_tree_foreach((GTree *)list, func, NULL)
40 #define _E(fmt, arg...) LOGE("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
41 #define _D(fmt, arg...) LOGD("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
42 #define _I(fmt, arg...) LOGI("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
44 #define _SE(fmt, arg...) SECURE_LOGE("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
45 #define _SD(fmt, arg...) SECURE_LOGD("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
46 #define _SI(fmt, arg...) SECURE_LOGI("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
48 #define TRACE_DB_ERR(a) if (a != NULL) { \
53 #define TRACE_RET_ERRCODE(type, error_code) do { \
55 strerror_r(-error_code, buf, sizeof(buf)); \
56 _##type("errno %d, errmsg %s", error_code, buf); \
59 #define DTRACE_RET_ERRCODE(error_code) TRACE_RET_ERRCODE(D, error_code)
61 #define ETRACE_RET_ERRCODE(error_code) TRACE_RET_ERRCODE(E, error_code)
63 #define TRACE_RET_ERRCODE_MSG(type, error_code, fmt, arg...) do { \
65 _##type(fmt, ##arg); \
66 strerror_r(-error_code, buf, sizeof(buf)); \
67 _##type("errno %d, errmsg %s", error_code, buf); \
70 #define DTRACE_RET_ERRCODE_MSG(error_code, fmt, arg...) \
71 TRACE_RET_ERRCODE_MSG(D, error_code, fmt, ##arg)
73 #define ETRACE_RET_ERRCODE_MSG(error_code, fmt, arg...) \
74 TRACE_RET_ERRCODE_MSG(E, error_code, fmt, ##arg)
76 #define DTRACE_ERRNO() TRACE_RET_ERRCODE(D, -errno)
78 #define ETRACE_ERRNO() TRACE_RET_ERRCODE(E, -errno)
80 #define DTRACE_ERRNO_MSG(fmt, arg...) \
81 TRACE_RET_ERRCODE_MSG(D, -errno, fmt, ##arg)
83 #define ETRACE_ERRNO_MSG(fmt, arg...) \
84 TRACE_RET_ERRCODE_MSG(E, -errno, fmt, ##arg)
86 #endif /* _SYSTEM_RESOURCE_TRACE_H_ */