From 35fd572dcb20db6beb702a2c71902d09bb4a50df Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 12 May 2005 13:52:49 +0000 Subject: [PATCH] - Gather statistics about failed mbuf+cluster+ng_item allocations. - Adjust comments and variables names in nfinfo. --- sys/netgraph/netflow/netflow.c | 5 ++--- sys/netgraph/netflow/ng_netflow.h | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index 4ed9e1984c82..ff94bef13e15 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -204,8 +204,7 @@ expire_flow(priv_p priv, item_p *item, struct flow_entry *fle) if (*item == NULL) *item = get_export_dgram(priv); if (*item == NULL) { - /* XXX: do stats! */ - log(LOG_DEBUG, "get_export_dgram failed\n"); + atomic_add_32(&priv->info.nfinfo_export_failed, 1); uma_zfree_arg(priv->zone, fle, priv); return; } @@ -259,7 +258,7 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, fle = uma_zalloc_arg(priv->zone, priv, M_NOWAIT); if (fle == NULL) { - atomic_add_32(&priv->info.nfinfo_failed, 1); + atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); return (ENOMEM); } diff --git a/sys/netgraph/netflow/ng_netflow.h b/sys/netgraph/netflow/ng_netflow.h index 20b7b0daf3a8..79037ee208fa 100644 --- a/sys/netgraph/netflow/ng_netflow.h +++ b/sys/netgraph/netflow/ng_netflow.h @@ -54,14 +54,15 @@ enum { /* This structure is returned by the NGM_NETFLOW_INFO message */ struct ng_netflow_info { - uint64_t nfinfo_bytes; /* total number of accounted bytes */ - uint32_t nfinfo_packets; /* total number of accounted packets */ - uint32_t nfinfo_used; /* number of used cache records */ - uint32_t nfinfo_failed; /* number of failed allocations */ - uint32_t nfinfo_act_exp; - uint32_t nfinfo_inact_exp; - uint32_t nfinfo_inact_t; /* flow inactive timeout */ - uint32_t nfinfo_act_t; /* flow active timeout */ + uint64_t nfinfo_bytes; /* accounted bytes */ + uint32_t nfinfo_packets; /* accounted packets */ + uint32_t nfinfo_used; /* used cache records */ + uint32_t nfinfo_alloc_failed; /* failed allocations */ + uint32_t nfinfo_export_failed; /* failed exports */ + uint32_t nfinfo_act_exp; /* active expiries */ + uint32_t nfinfo_inact_exp; /* inactive expiries */ + uint32_t nfinfo_inact_t; /* flow inactive timeout */ + uint32_t nfinfo_act_t; /* flow active timeout */ }; /* This structure is returned by the NGM_NETFLOW_IFINFO message */ @@ -168,6 +169,7 @@ struct flow_entry { { "Packets", &ng_parse_uint32_type }, \ { "Records used", &ng_parse_uint32_type },\ { "Failed allocations", &ng_parse_uint32_type },\ + { "Failed exports", &ng_parse_uint32_type },\ { "Active expiries", &ng_parse_uint32_type },\ { "Inactive expiries", &ng_parse_uint32_type },\ { "Inactive timeout", &ng_parse_uint32_type },\