From 1ff8fec00c6a452cbcbe342eb137342dfdb33f5d Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 5 Aug 2004 19:23:11 +0000 Subject: Get rid of some statistics stuff that is no longer needed but helped in the beginning. OK henning@ --- usr.sbin/bgpd/rde_prefix.c | 30 +------------------ usr.sbin/bgpd/rde_rib.c | 74 +--------------------------------------------- 2 files changed, 2 insertions(+), 102 deletions(-) diff --git a/usr.sbin/bgpd/rde_prefix.c b/usr.sbin/bgpd/rde_prefix.c index d4cc5854fe5..80f12a6cc2a 100644 --- a/usr.sbin/bgpd/rde_prefix.c +++ b/usr.sbin/bgpd/rde_prefix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_prefix.c,v 1.18 2004/08/05 18:44:19 claudio Exp $ */ +/* $OpenBSD: rde_prefix.c,v 1.19 2004/08/05 19:23:10 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -58,24 +58,6 @@ RB_GENERATE(pt_tree, pt_entry, pt_e, pt_prefix_cmp); struct pt_tree pttable4; struct pt_tree pttable6; -/* - * Statistics collector. - * Collected to tune the prefix table. Currently only a few counters were - * added. More to come as soon as we see where we are going. - * TODO: add a function that dumps the stats after a specified period of time. - */ -struct pt_stats { - u_int64_t pt_alloc; - u_int64_t pt_free; - u_int64_t pt_add; - u_int64_t pt_get; - u_int64_t pt_remove; - u_int64_t pt_lookup; - u_int64_t pt_dump; -} ptstats; -/* simple macros to update statistics */ -#define PT_STAT(x) (ptstats.x++) - void pt_init(void) { @@ -125,8 +107,6 @@ pt_get(struct bgpd_addr *prefix, int prefixlen) struct pt_entry6 pte6; in_addr_t addr_hbo; - PT_STAT(pt_get); - switch (prefix->af) { case AF_INET: if (prefixlen > 32) @@ -159,8 +139,6 @@ pt_add(struct bgpd_addr *prefix, int prefixlen) struct pt_entry6 *p6; in_addr_t addr_hbo; - PT_STAT(pt_add); - switch (prefix->af) { case AF_INET: p4 = pt_alloc4(); @@ -200,8 +178,6 @@ pt_add(struct bgpd_addr *prefix, int prefixlen) void pt_remove(struct pt_entry *pte) { - PT_STAT(pt_remove); - if (!pt_empty(pte)) fatalx("pt_remove: entry not empty"); @@ -227,7 +203,6 @@ pt_lookup(struct bgpd_addr *prefix) struct pt_entry *p; int i; - PT_STAT(pt_lookup); switch (prefix->af) { case AF_INET: for (i = 32; i >= 0; i--) { @@ -311,7 +286,6 @@ pt_alloc4(void) { struct pt_entry4 *p; - PT_STAT(pt_alloc); p = calloc(1, sizeof(*p)); if (p == NULL) fatal("pt_alloc"); @@ -323,7 +297,6 @@ pt_alloc6(void) { struct pt_entry6 *p; - PT_STAT(pt_alloc); p = calloc(1, sizeof(*p)); if (p == NULL) fatal("pt_alloc"); @@ -333,7 +306,6 @@ pt_alloc6(void) static void pt_free(struct pt_entry *pte) { - PT_STAT(pt_free); free(pte); } diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 482f73d139b..b79ac85b514 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.53 2004/08/05 18:44:19 claudio Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.54 2004/08/05 19:23:10 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker @@ -34,35 +34,6 @@ * This is achieved by heavily linking the different parts together. */ -struct rib_stats { - u_int64_t path_update; - u_int64_t path_get; - u_int64_t path_add; - u_int64_t path_remove; - u_int64_t path_updateall; - u_int64_t path_destroy; - u_int64_t path_link; - u_int64_t path_unlink; - u_int64_t path_alloc; - u_int64_t path_free; - u_int64_t prefix_get; - u_int64_t prefix_add; - u_int64_t prefix_move; - u_int64_t prefix_remove; - u_int64_t prefix_updateall; - u_int64_t prefix_link; - u_int64_t prefix_unlink; - u_int64_t prefix_alloc; - u_int64_t prefix_free; - u_int64_t nexthop_add; - u_int64_t nexthop_remove; - u_int64_t nexthop_update; - u_int64_t nexthop_get; - u_int64_t nexthop_alloc; - u_int64_t nexthop_free; -} ribstats; -#define RIB_STAT(x) (ribstats.x++) - /* path specific functions */ static void path_link(struct rde_aspath *, struct rde_peer *); @@ -113,8 +84,6 @@ path_update(struct rde_peer *peer, struct attr_flags *attrs, struct prefix *p; struct pt_entry *pte; - RIB_STAT(path_update); - rde_send_pftable(attrs->pftable, prefix, prefixlen, 0); rde_send_pftable_commit(); @@ -146,8 +115,6 @@ path_get(struct aspath *aspath, struct rde_peer *peer) struct aspath_head *head; struct rde_aspath *asp; - RIB_STAT(path_get); - head = PATH_HASH(aspath); LIST_FOREACH(asp, head, path_l) { @@ -163,8 +130,6 @@ path_add(struct rde_peer *peer, struct attr_flags *attr) { struct rde_aspath *asp; - RIB_STAT(path_add); - asp = path_alloc(); attr_move(&asp->flags, attr); @@ -179,8 +144,6 @@ path_remove(struct rde_aspath *asp) struct prefix *p; struct bgpd_addr addr; - RIB_STAT(path_remove); - while ((p = LIST_FIRST(&asp->prefix_h)) != NULL) { /* Commit is done in peer_down() */ pt_getaddr(p->prefix, &addr); @@ -195,8 +158,6 @@ path_remove(struct rde_aspath *asp) void path_updateall(struct rde_aspath *asp, enum nexthop_state state) { - RIB_STAT(path_updateall); - if (rde_noevaluate()) /* if the decision process is turned off this is a no-op */ return; @@ -208,7 +169,6 @@ path_updateall(struct rde_aspath *asp, enum nexthop_state state) void path_destroy(struct rde_aspath *asp) { - RIB_STAT(path_destroy); /* path_destroy can only unlink and free empty rde_aspath */ ENSURE(path_empty(asp)); @@ -234,8 +194,6 @@ path_link(struct rde_aspath *asp, struct rde_peer *peer) { struct aspath_head *head; - RIB_STAT(path_link); - head = PATH_HASH(asp->flags.aspath); LIST_INSERT_HEAD(head, asp, path_l); @@ -248,7 +206,6 @@ path_link(struct rde_aspath *asp, struct rde_peer *peer) static void path_unlink(struct rde_aspath *asp) { - RIB_STAT(path_unlink); ENSURE(path_empty(asp)); ENSURE(asp->prefix_cnt == 0 && asp->active_cnt == 0); @@ -267,8 +224,6 @@ path_alloc(void) { struct rde_aspath *asp; - RIB_STAT(path_alloc); - asp = calloc(1, sizeof(*asp)); if (asp == NULL) fatal("path_alloc"); @@ -280,7 +235,6 @@ path_alloc(void) static void path_free(struct rde_aspath *asp) { - RIB_STAT(path_free); ENSURE(asp->peer == NULL && asp->flags.aspath == NULL && TAILQ_EMPTY(&asp->flags.others)); @@ -344,8 +298,6 @@ prefix_get(struct rde_aspath *asp, struct bgpd_addr *prefix, int prefixlen) struct prefix *p; struct bgpd_addr addr; - RIB_STAT(prefix_get); - LIST_FOREACH(p, &asp->prefix_h, path_l) { ENSURE(p->prefix != NULL); if (p->prefix->prefixlen != prefixlen) @@ -371,8 +323,6 @@ prefix_add(struct rde_aspath *asp, struct bgpd_addr *prefix, int prefixlen) struct pt_entry *pte; int needlink = 0; - RIB_STAT(prefix_add); - pte = pt_get(prefix, prefixlen); if (pte == NULL) { pte = pt_add(prefix, prefixlen); @@ -404,7 +354,6 @@ prefix_move(struct rde_aspath *asp, struct prefix *p) struct prefix *np; struct rde_aspath *oasp; - RIB_STAT(prefix_move); ENSURE(asp->peer == p->peer); /* create new prefix node */ @@ -463,8 +412,6 @@ prefix_remove(struct rde_peer *peer, struct bgpd_addr *prefix, int prefixlen) struct pt_entry *pte; struct rde_aspath *asp; - RIB_STAT(prefix_remove); - pte = pt_get(prefix, prefixlen); if (pte == NULL) /* Got a dummy withdrawn request */ return; @@ -508,8 +455,6 @@ prefix_updateall(struct rde_aspath *asp, enum nexthop_state state) { struct prefix *p; - RIB_STAT(prefix_updateall); - if (rde_noevaluate()) /* if the decision process is turned off this is a no-op */ return; @@ -579,7 +524,6 @@ prefix_network_clean(struct rde_peer *peer, time_t reloadtime) static void prefix_link(struct prefix *pref, struct pt_entry *pte, struct rde_aspath *asp) { - RIB_STAT(prefix_link); ENSURE(pref->aspath == NULL && pref->prefix == NULL); ENSURE(prefix_bypeer(pte, asp->peer) == NULL); @@ -603,8 +547,6 @@ prefix_link(struct prefix *pref, struct pt_entry *pte, struct rde_aspath *asp) static void prefix_unlink(struct prefix *pref) { - RIB_STAT(prefix_unlink); - /* make route decision */ LIST_REMOVE(pref, prefix_l); prefix_evaluate(NULL, pref->prefix); @@ -629,8 +571,6 @@ prefix_alloc(void) { struct prefix *p; - RIB_STAT(prefix_alloc); - p = calloc(1, sizeof(*p)); if (p == NULL) fatal("prefix_alloc"); @@ -641,7 +581,6 @@ prefix_alloc(void) static void prefix_free(struct prefix *pref) { - RIB_STAT(prefix_free); ENSURE(pref->aspath == NULL && pref->prefix == NULL); free(pref); @@ -745,8 +684,6 @@ nexthop_add(struct rde_aspath *asp) { struct nexthop *nh; - RIB_STAT(nexthop_add); - if ((nh = asp->nexthop) == NULL) nh = nexthop_get(asp->flags.nexthop); if (nh == NULL) { @@ -767,8 +704,6 @@ nexthop_remove(struct rde_aspath *asp) { struct nexthop *nh; - RIB_STAT(nexthop_remove); - LIST_REMOVE(asp, nexthop_l); /* see if list is empty */ @@ -790,8 +725,6 @@ nexthop_get(struct in_addr nexthop) { struct nexthop *nh; - RIB_STAT(nexthop_get); - LIST_FOREACH(nh, NEXTHOP_HASH(nexthop), nexthop_l) { if (nh->exit_nexthop.v4.s_addr == nexthop.s_addr) return nh; @@ -805,8 +738,6 @@ nexthop_update(struct kroute_nexthop *msg) struct nexthop *nh; struct rde_aspath *asp; - RIB_STAT(nexthop_update); - nh = nexthop_get(msg->nexthop.v4); if (nh == NULL) { log_warnx("nexthop_update: non-existent nexthop"); @@ -856,8 +787,6 @@ nexthop_alloc(void) { struct nexthop *nh; - RIB_STAT(nexthop_alloc); - nh = calloc(1, sizeof(*nh)); if (nh == NULL) fatal("nexthop_alloc"); @@ -868,7 +797,6 @@ nexthop_alloc(void) static void nexthop_free(struct nexthop *nh) { - RIB_STAT(nexthop_free); ENSURE(LIST_EMPTY(&nh->path_h)); free(nh); -- cgit v1.2.3