2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 * @brief cuckoo debugs
19 #ifndef __included_cuckoo_debug_h__
20 #define __included_cuckoo_debug_h__
22 /* controls debug counters */
23 #define CLIB_CUCKOO_DEBUG_COUNTERS (0)
25 /* controls debug prints */
26 #define CLIB_CUCKOO_DEBUG (0)
28 /* controls garbage collection related debug prints */
29 #define CLIB_CUCKOO_DEBUG_GC (0)
32 #define CLIB_CUCKOO_DEBUG_FILE_DEF \
33 static const char *__file = NULL; \
35 __file = strrchr (__FILE__, '/'); \
46 #define CLIB_CUCKOO_DBG(fmt, ...) \
49 CLIB_CUCKOO_DEBUG_FILE_DEF \
50 static u8 *_s = NULL; \
51 _s = format (_s, "DBG:%s:%d:%s():" fmt, __file, __LINE__, __func__, \
53 printf ("%.*s\n", vec_len (_s), _s); \
54 vec_reset_length (_s); \
58 #define CLIB_CUCKOO_ERR(fmt, ...) \
61 CLIB_CUCKOO_DEBUG_FILE_DEF \
62 static u8 *_s = NULL; \
63 _s = format (_s, "ERR:%s:%d:%s():" fmt, __file, __LINE__, __func__, \
65 printf ("%.*s\n", vec_len (_s), _s); \
66 vec_reset_length (_s); \
71 #define CLIB_CUCKOO_DBG(...)
72 #define CLIB_CUCKOO_ERR(...)
75 #endif /* __included_cuckoo_debug_h__ */
78 * fd.io coding-style-patch-verification: ON
81 * eval: (c-set-style "gnu")