FD.io VPP
v19.08.3-2-gbabecb413
Vector Packet Processing
cuckoo_debug.h
Go to the documentation of this file.
1
/*
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:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
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.
14
*/
15
/**
16
* @file
17
* @brief cuckoo debugs
18
*/
19
#ifndef __included_cuckoo_debug_h__
20
#define __included_cuckoo_debug_h__
21
22
/* controls debug counters */
23
#define CLIB_CUCKOO_DEBUG_COUNTERS (0)
24
25
/* controls debug prints */
26
#define CLIB_CUCKOO_DEBUG (0)
27
28
/* controls garbage collection related debug prints */
29
#define CLIB_CUCKOO_DEBUG_GC (0)
30
31
#if CLIB_CUCKOO_DEBUG
32
#define CLIB_CUCKOO_DEBUG_FILE_DEF \
33
static const char *__file = NULL; \
34
{ \
35
__file = strrchr (__FILE__, '/'); \
36
if (__file) \
37
{ \
38
++__file; \
39
} \
40
else \
41
{ \
42
__file = __FILE__; \
43
} \
44
}
45
46
#define CLIB_CUCKOO_DBG(fmt, ...) \
47
do \
48
{ \
49
CLIB_CUCKOO_DEBUG_FILE_DEF \
50
static u8 *_s = NULL; \
51
_s = format (_s, "DBG:%s:%d:%s():" fmt, __file, __LINE__, __func__, \
52
##__VA_ARGS__); \
53
printf ("%.*s\n", vec_len (_s), _s); \
54
vec_reset_length (_s); \
55
} \
56
while (0);
57
58
#define CLIB_CUCKOO_ERR(fmt, ...) \
59
do \
60
{ \
61
CLIB_CUCKOO_DEBUG_FILE_DEF \
62
static u8 *_s = NULL; \
63
_s = format (_s, "ERR:%s:%d:%s():" fmt, __file, __LINE__, __func__, \
64
##__VA_ARGS__); \
65
printf ("%.*s\n", vec_len (_s), _s); \
66
vec_reset_length (_s); \
67
} \
68
while (0);
69
70
#else
71
#define CLIB_CUCKOO_DBG(...)
72
#define CLIB_CUCKOO_ERR(...)
73
#endif
74
75
#endif
/* __included_cuckoo_debug_h__ */
76
77
/*
78
* fd.io coding-style-patch-verification: ON
79
*
80
* Local Variables:
81
* eval: (c-set-style "gnu")
82
* End:
83
*/
src
vppinfra
cuckoo_debug.h
Generated on Mon Oct 19 2020 14:05:10 for FD.io VPP by
1.8.13