diff options
-rw-r--r-- | bgpd/bgp_io.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 12 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 18 | ||||
-rw-r--r-- | bgpd/bgp_trace.h | 11 | ||||
-rw-r--r-- | lib/frr_pthread.c | 4 | ||||
-rw-r--r-- | lib/hash.c | 6 | ||||
-rw-r--r-- | lib/libfrr_trace.h | 13 | ||||
-rw-r--r-- | lib/linklist.c | 8 | ||||
-rw-r--r-- | lib/memory.c | 4 | ||||
-rw-r--r-- | lib/table.c | 4 | ||||
-rw-r--r-- | lib/thread.c | 44 | ||||
-rw-r--r-- | lib/zlog.c | 10 |
12 files changed, 59 insertions, 79 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 65b388e61..0997fdba9 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -39,7 +39,7 @@ #include "bgpd/bgp_errors.h" // for expanded error reference information #include "bgpd/bgp_fsm.h" // for BGP_EVENT_ADD, bgp_event #include "bgpd/bgp_packet.h" // for bgp_notify_send_with_data, bgp_notify... -#include "bgpd/bgp_trace.h" // for tracepoints +#include "bgpd/bgp_trace.h" // for frrtraces #include "bgpd/bgpd.h" // for peer, BGP_MARKER_SIZE, bgp_master, bm /* clang-format on */ @@ -236,7 +236,7 @@ static int bgp_process_reads(struct thread *thread) stream_set_endp(pkt, pktsize); frr_with_mutex(&peer->io_mtx) { - tracepoint(frr_bgp, packet_read, peer, pkt); + frrtrace(2, frr_bgp, packet_read, peer, pkt); stream_fifo_push(peer->ibuf, pkt); } diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index f498dc69d..2ebac5667 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2367,7 +2367,7 @@ int bgp_process_packet(struct thread *thread) */ switch (type) { case BGP_MSG_OPEN: - tracepoint(frr_bgp, open_process, peer, size); + frrtrace(2, frr_bgp, open_process, peer, size); atomic_fetch_add_explicit(&peer->open_in, 1, memory_order_relaxed); mprc = bgp_open_receive(peer, size); @@ -2378,7 +2378,7 @@ int bgp_process_packet(struct thread *thread) __func__, peer->host); break; case BGP_MSG_UPDATE: - tracepoint(frr_bgp, update_process, peer, size); + frrtrace(2, frr_bgp, update_process, peer, size); atomic_fetch_add_explicit(&peer->update_in, 1, memory_order_relaxed); peer->readtime = monotime(NULL); @@ -2390,7 +2390,7 @@ int bgp_process_packet(struct thread *thread) __func__, peer->host); break; case BGP_MSG_NOTIFY: - tracepoint(frr_bgp, notification_process, peer, size); + frrtrace(2, frr_bgp, notification_process, peer, size); atomic_fetch_add_explicit(&peer->notify_in, 1, memory_order_relaxed); mprc = bgp_notify_receive(peer, size); @@ -2401,7 +2401,7 @@ int bgp_process_packet(struct thread *thread) __func__, peer->host); break; case BGP_MSG_KEEPALIVE: - tracepoint(frr_bgp, keepalive_process, peer, size); + frrtrace(2, frr_bgp, keepalive_process, peer, size); peer->readtime = monotime(NULL); atomic_fetch_add_explicit(&peer->keepalive_in, 1, memory_order_relaxed); @@ -2414,7 +2414,7 @@ int bgp_process_packet(struct thread *thread) break; case BGP_MSG_ROUTE_REFRESH_NEW: case BGP_MSG_ROUTE_REFRESH_OLD: - tracepoint(frr_bgp, refresh_process, peer, size); + frrtrace(2, frr_bgp, refresh_process, peer, size); atomic_fetch_add_explicit(&peer->refresh_in, 1, memory_order_relaxed); mprc = bgp_route_refresh_receive(peer, size); @@ -2425,7 +2425,7 @@ int bgp_process_packet(struct thread *thread) __func__, peer->host); break; case BGP_MSG_CAPABILITY: - tracepoint(frr_bgp, capability_process, peer, size); + frrtrace(2, frr_bgp, capability_process, peer, size); atomic_fetch_add_explicit(&peer->dynamic_cap_in, 1, memory_order_relaxed); mprc = bgp_capability_receive(peer, size); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index e3c6c463a..4713452d5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1329,12 +1329,12 @@ static enum filter_type bgp_input_filter(struct peer *peer, } done: - if (tracepoint_enabled(frr_bgp, input_filter)) { + if (frrtrace_enabled(frr_bgp, input_filter)) { char pfxprint[PREFIX2STR_BUFFER]; prefix2str(p, pfxprint, sizeof(pfxprint)); - tracepoint(frr_bgp, input_filter, peer, pfxprint, afi, safi, - ret == FILTER_PERMIT ? "permit" : "deny"); + frrtrace(5, frr_bgp, input_filter, peer, pfxprint, afi, safi, + ret == FILTER_PERMIT ? "permit" : "deny"); } return ret; @@ -1386,12 +1386,12 @@ static enum filter_type bgp_output_filter(struct peer *peer, } } - if (tracepoint_enabled(frr_bgp, output_filter)) { + if (frrtrace_enabled(frr_bgp, output_filter)) { char pfxprint[PREFIX2STR_BUFFER]; prefix2str(p, pfxprint, sizeof(pfxprint)); - tracepoint(frr_bgp, output_filter, peer, pfxprint, afi, safi, - ret == FILTER_PERMIT ? "permit" : "deny"); + frrtrace(5, frr_bgp, output_filter, peer, pfxprint, afi, safi, + ret == FILTER_PERMIT ? "permit" : "deny"); } done: @@ -3463,12 +3463,12 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id, uint8_t pi_type = 0; uint8_t pi_sub_type = 0; - if (tracepoint_enabled(frr_bgp, process_update)) { + if (frrtrace_enabled(frr_bgp, process_update)) { char pfxprint[PREFIX2STR_BUFFER]; prefix2str(p, pfxprint, sizeof(pfxprint)); - tracepoint(frr_bgp, process_update, peer, pfxprint, addpath_id, - afi, safi, attr); + frrtrace(6, frr_bgp, process_update, peer, pfxprint, addpath_id, + afi, safi, attr); } #ifdef ENABLE_BGP_VNC diff --git a/bgpd/bgp_trace.h b/bgpd/bgp_trace.h index 4b79155ef..bd26c8de8 100644 --- a/bgpd/bgp_trace.h +++ b/bgpd/bgp_trace.h @@ -21,9 +21,7 @@ #if !defined(_BGP_TRACE_H) || defined(TRACEPOINT_HEADER_MULTI_READ) #define _BGP_TRACE_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "lib/trace.h" #ifdef HAVE_LTTNG @@ -122,13 +120,6 @@ TRACEPOINT_LOGLEVEL(frr_bgp, output_filter, TRACE_INFO) #include <lttng/tracepoint-event.h> -#else /* HAVE_LTTNG */ - -#define tracepoint(...) -#define tracef(...) -#define tracelog(...) -#define tracepoint_enabled(...) true - #endif /* HAVE_LTTNG */ #endif /* _BGP_TRACE_H */ diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 689284eb6..3f0179fbc 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -168,7 +168,7 @@ int frr_pthread_run(struct frr_pthread *fpt, const pthread_attr_t *attr) sigfillset(&blocksigs); pthread_sigmask(SIG_BLOCK, &blocksigs, &oldsigs); - tracepoint(frr_libfrr, frr_pthread_run, fpt->name); + frrtrace(1, frr_libfrr, frr_pthread_run, fpt->name); fpt->rcu_thread = rcu_thread_prepare(); ret = pthread_create(&fpt->thread, attr, frr_pthread_inner, fpt); @@ -207,7 +207,7 @@ void frr_pthread_notify_running(struct frr_pthread *fpt) int frr_pthread_stop(struct frr_pthread *fpt, void **result) { - tracepoint(frr_libfrr, frr_pthread_stop, fpt->name); + frrtrace(1, frr_libfrr, frr_pthread_stop, fpt->name); int ret = (*fpt->attr.stop)(fpt, result); memset(&fpt->thread, 0x00, sizeof(fpt->thread)); diff --git a/lib/hash.c b/lib/hash.c index f34a2aae0..ed429b77d 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -139,7 +139,7 @@ static void hash_expand(struct hash *hash) void *hash_get(struct hash *hash, void *data, void *(*alloc_func)(void *)) { - tracepoint(frr_libfrr, hash_get, hash, data); + frrtrace(2, frr_libfrr, hash_get, hash, data); unsigned int key; unsigned int index; @@ -175,7 +175,7 @@ void *hash_get(struct hash *hash, void *data, void *(*alloc_func)(void *)) hash->index[index] = bucket; hash->count++; - tracepoint(frr_libfrr, hash_insert, hash, data, key); + frrtrace(3, frr_libfrr, hash_insert, hash, data, key); int oldlen = bucket->next ? bucket->next->len : 0; int newlen = oldlen + 1; @@ -246,7 +246,7 @@ void *hash_release(struct hash *hash, void *data) pp = bucket; } - tracepoint(frr_libfrr, hash_release, hash, data, ret); + frrtrace(3, frr_libfrr, hash_release, hash, data, ret); return ret; } diff --git a/lib/libfrr_trace.h b/lib/libfrr_trace.h index 337360852..7215007ff 100644 --- a/lib/libfrr_trace.h +++ b/lib/libfrr_trace.h @@ -21,9 +21,7 @@ #if !defined(_LIBFRR_TRACE_H_) || defined(TRACEPOINT_HEADER_MULTI_READ) #define _LIBFRR_TRACE_H_ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ +#include "trace.h" #ifdef HAVE_LTTNG @@ -237,13 +235,6 @@ TRACEPOINT_EVENT( #include <lttng/tracepoint-event.h> #include <lttng/tracelog.h> -#else /* HAVE_LTTNG */ - -#define tracepoint(...) -#define tracef(...) -#define tracelog(...) -#define tracepoint_enabled(...) true - #endif /* HAVE_LTTNG */ -#endif /* _TRACE_H */ +#endif /* _LIBFRR_TRACE_H_ */ diff --git a/lib/linklist.c b/lib/linklist.c index ea206d89e..43c200223 100644 --- a/lib/linklist.c +++ b/lib/linklist.c @@ -67,7 +67,7 @@ static void listnode_free(struct list *list, struct listnode *node) struct listnode *listnode_add(struct list *list, void *val) { - tracepoint(frr_libfrr, list_add, list, val); + frrtrace(2, frr_libfrr, list_add, list, val); struct listnode *node; @@ -284,7 +284,7 @@ void listnode_move_to_tail(struct list *l, struct listnode *n) void listnode_delete(struct list *list, const void *val) { - tracepoint(frr_libfrr, list_remove, list, val); + frrtrace(2, frr_libfrr, list_remove, list, val); struct listnode *node = listnode_lookup(list, val); @@ -365,7 +365,7 @@ struct listnode *listnode_lookup_nocheck(struct list *list, void *data) void list_delete_node(struct list *list, struct listnode *node) { - tracepoint(frr_libfrr, list_delete_node, list, node); + frrtrace(2, frr_libfrr, list_delete_node, list, node); if (node->prev) node->prev->next = node->next; @@ -381,7 +381,7 @@ void list_delete_node(struct list *list, struct listnode *node) void list_sort(struct list *list, int (*cmp)(const void **, const void **)) { - tracepoint(frr_libfrr, list_sort, list); + frrtrace(1, frr_libfrr, list_sort, list); struct listnode *ln, *nn; int i = -1; diff --git a/lib/memory.c b/lib/memory.c index 6bc46b2f3..f715044ea 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -78,7 +78,7 @@ static inline void mt_count_alloc(struct memtype *mt, size_t size, void *ptr) static inline void mt_count_free(struct memtype *mt, void *ptr) { - tracepoint(frr_libfrr, memfree, mt, ptr); + frrtrace(2, frr_libfrr, memfree, mt, ptr); assert(mt->n_alloc); atomic_fetch_sub_explicit(&mt->n_alloc, 1, memory_order_relaxed); @@ -92,7 +92,7 @@ static inline void mt_count_free(struct memtype *mt, void *ptr) static inline void *mt_checkalloc(struct memtype *mt, void *ptr, size_t size) { - tracepoint(frr_libfrr, memalloc, mt, ptr, size); + frrtrace(3, frr_libfrr, memalloc, mt, ptr, size); if (__builtin_expect(ptr == NULL, 0)) { if (size) { diff --git a/lib/table.c b/lib/table.c index 26bcca4b2..89e32182b 100644 --- a/lib/table.c +++ b/lib/table.c @@ -277,10 +277,10 @@ struct route_node *route_node_lookup_maynull(struct route_table *table, struct route_node *route_node_get(struct route_table *table, union prefixconstptr pu) { - if (tracepoint_enabled(frr_libfrr, route_node_get)) { + if (frrtrace_enabled(frr_libfrr, route_node_get)) { char buf[PREFIX2STR_BUFFER]; prefix2str(pu, buf, sizeof(buf)); - tracepoint(frr_libfrr, route_node_get, table, buf); + frrtrace(2, frr_libfrr, route_node_get, table, buf); } struct route_node search; diff --git a/lib/thread.c b/lib/thread.c index a15bd541d..9a5453b18 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -789,11 +789,11 @@ struct thread *funcname_thread_add_read_write(int dir, struct thread_master *m, struct thread **thread_array; if (dir == THREAD_READ) - tracepoint(frr_libfrr, schedule_read, m, funcname, schedfrom, - fromln, t_ptr, fd, 0, arg, 0); + frrtrace(9, frr_libfrr, schedule_read, m, funcname, schedfrom, + fromln, t_ptr, fd, 0, arg, 0); else - tracepoint(frr_libfrr, schedule_write, m, funcname, schedfrom, - fromln, t_ptr, fd, 0, arg, 0); + frrtrace(9, frr_libfrr, schedule_write, m, funcname, schedfrom, + fromln, t_ptr, fd, 0, arg, 0); assert(fd >= 0 && fd < m->fd_limit); frr_with_mutex(&m->mtx) { @@ -869,8 +869,8 @@ funcname_thread_add_timer_timeval(struct thread_master *m, assert(type == THREAD_TIMER); assert(time_relative); - tracepoint(frr_libfrr, schedule_timer, m, funcname, schedfrom, fromln, - t_ptr, 0, 0, arg, (long)time_relative->tv_sec); + frrtrace(9, frr_libfrr, schedule_timer, m, funcname, schedfrom, fromln, + t_ptr, 0, 0, arg, (long)time_relative->tv_sec); frr_with_mutex(&m->mtx) { if (t_ptr && *t_ptr) @@ -950,8 +950,8 @@ struct thread *funcname_thread_add_event(struct thread_master *m, { struct thread *thread = NULL; - tracepoint(frr_libfrr, schedule_event, m, funcname, schedfrom, fromln, - t_ptr, 0, val, arg, 0); + frrtrace(9, frr_libfrr, schedule_event, m, funcname, schedfrom, fromln, + t_ptr, 0, val, arg, 0); assert(m != NULL); @@ -1181,10 +1181,9 @@ void thread_cancel(struct thread *thread) { struct thread_master *master = thread->master; - tracepoint(frr_libfrr, thread_cancel, master, thread->funcname, - thread->schedfrom, thread->schedfrom_line, NULL, - thread->u.fd, thread->u.val, thread->arg, - thread->u.sands.tv_sec); + frrtrace(9, frr_libfrr, thread_cancel, master, thread->funcname, + thread->schedfrom, thread->schedfrom_line, NULL, thread->u.fd, + thread->u.val, thread->arg, thread->u.sands.tv_sec); assert(master->owner == pthread_self()); @@ -1227,14 +1226,14 @@ void thread_cancel_async(struct thread_master *master, struct thread **thread, assert(!(thread && eventobj) && (thread || eventobj)); if (thread && *thread) - tracepoint(frr_libfrr, thread_cancel_async, master, - (*thread)->funcname, (*thread)->schedfrom, - (*thread)->schedfrom_line, NULL, (*thread)->u.fd, - (*thread)->u.val, (*thread)->arg, - (*thread)->u.sands.tv_sec); + frrtrace(9, frr_libfrr, thread_cancel_async, master, + (*thread)->funcname, (*thread)->schedfrom, + (*thread)->schedfrom_line, NULL, (*thread)->u.fd, + (*thread)->u.val, (*thread)->arg, + (*thread)->u.sands.tv_sec); else - tracepoint(frr_libfrr, thread_cancel_async, master, NULL, NULL, - 0, NULL, 0, 0, eventobj, 0); + frrtrace(9, frr_libfrr, thread_cancel_async, master, NULL, NULL, + 0, NULL, 0, 0, eventobj, 0); assert(master->owner != pthread_self()); @@ -1611,10 +1610,9 @@ void thread_call(struct thread *thread) GETRUSAGE(&before); thread->real = before.real; - tracepoint(frr_libfrr, thread_call, thread->master, thread->funcname, - thread->schedfrom, thread->schedfrom_line, NULL, - thread->u.fd, thread->u.val, thread->arg, - thread->u.sands.tv_sec); + frrtrace(9, frr_libfrr, thread_call, thread->master, thread->funcname, + thread->schedfrom, thread->schedfrom_line, NULL, thread->u.fd, + thread->u.val, thread->arg, thread->u.sands.tv_sec); pthread_setspecific(thread_current, thread); (*thread->func)(thread); diff --git a/lib/zlog.c b/lib/zlog.c index aec8744b9..e77feec5f 100644 --- a/lib/zlog.c +++ b/lib/zlog.c @@ -458,20 +458,20 @@ void vzlog(int prio, const char *fmt, va_list ap) switch (prio) { case LOG_ERR: - tracelog(TRACE_ERR, msg); + frrtracelog(TRACE_ERR, msg); break; case LOG_WARNING: - tracelog(TRACE_WARNING, msg); + frrtracelog(TRACE_WARNING, msg); break; case LOG_DEBUG: - tracelog(TRACE_DEBUG, msg); + frrtracelog(TRACE_DEBUG, msg); break; case LOG_NOTICE: - tracelog(TRACE_DEBUG, msg); + frrtracelog(TRACE_DEBUG, msg); break; case LOG_INFO: default: - tracelog(TRACE_INFO, msg); + frrtracelog(TRACE_INFO, msg); break; } |