diff options
author | berat <beratiz@gmail.com> | 2017-09-26 17:20:51 +0200 |
---|---|---|
committer | berat <beratiz@gmail.com> | 2017-09-26 17:20:51 +0200 |
commit | f255b10524764c15f5e0dec4d55a3967c831a7c8 (patch) | |
tree | 7b2ce52c248e0a18f806374494572be463cdaee8 /example/ndpiReader.c | |
parent | 4ba6ba70c59d5be1fcf5946ecb8d72be945f34fc (diff) |
memory improvement again for (-b flag) statistics
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r-- | example/ndpiReader.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c index 92765b5c4..e527255fd 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -115,8 +115,8 @@ struct info_pair { typedef struct node_a{ u_int32_t addr; u_int8_t version; /* IP version */ - int count; char proto[16]; /*app level protocol*/ + int count; struct node_a *left, *right; }addr_node; @@ -124,34 +124,19 @@ struct port_stats { u_int32_t port; /* we'll use this field as the key */ u_int32_t num_pkts, num_bytes; u_int32_t num_flows; - u_int32_t num_addr; /*to hold number of distinct IP addresses */ - u_int32_t cumulative_addr; /*to hold cumulative some of IP addresses */ - addr_node *addr_tree; /* to hold distinct IP addresses */ + u_int32_t num_addr; /*number of distinct IP addresses */ + u_int32_t cumulative_addr; /*cumulative some of IP addresses */ + addr_node *addr_tree; /* tree of distinct IP addresses */ struct info_pair top_ip_addrs[MAX_NUM_IP_ADDRESS]; u_int8_t hasTopHost; /* as boolean flag*/ u_int32_t top_host; /*host that is contributed to > 95% of traffic*/ - u_int8_t version; /* top ip's versiob */ - char proto[16]; /*application level protocol of top_ip */ - + u_int8_t version; /* top host's ip version */ + char proto[16]; /*application level protocol of top host */ UT_hash_handle hh; /* makes this structure hashable */ }; struct port_stats *srcStats = NULL, *dstStats = NULL; -// struct to hold port based top statistics -//struct top_stats { -//u_int32_t port; /* we'll use this field as the key */ -//u_int32_t top_ip; /*ip address that is contributed to > 95% of traffic*/ -//u_int8_t version; /* top ip's versiob */ -//char proto[16]; /*application level protocol of top_ip */ -//u_int32_t num_pkts; -//u_int32_t num_addr; /*to hold number of distinct IP addresses */ -//u_int32_t num_flows; -//UT_hash_handle hh; /* makes this structure hashable */ -//}; - -//struct top_stats *topSrcStats = NULL, *topDstStats = NULL; - // struct to hold count of flows received by destination ports struct port_flow_info { @@ -1011,9 +996,8 @@ void updateTopIpAddress(u_int32_t addr, u_int8_t version, const char *proto, } } - if(update) { + if(update) top[min_i] = pair; - } } /* *********************************************** */ |