From 03fd39d7f0c409a45e422d9142b48536ec5c8647 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 4 Sep 2013 23:15:59 +0000 Subject: Throughput graph updates. GTK+: Fix what appears to be an off-by-one error in the MA period (21 segments instead of 20). Throw away our initial segment length instead of subtracting it from the moving sum, which skews the sum. Qt: Add the througput graph. Use bits/s for the throughput y axis. Let the user switch between graph types. The dialog hangs when doing this. I haven't been able to track down the cause. Remove some unused code. Both: Tell the user that we're using a 20 segment moving average. Move more routines to tap-tcp-stream.[ch]. svn path=/trunk/; revision=51759 --- ui/tap-tcp-stream.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'ui/tap-tcp-stream.c') diff --git a/ui/tap-tcp-stream.c b/ui/tap-tcp-stream.c index 4be31f4c4e..dffa6cd15d 100644 --- a/ui/tap-tcp-stream.c +++ b/ui/tap-tcp-stream.c @@ -176,6 +176,44 @@ compare_headers(address *saddr1, address *daddr1, guint16 sport1, guint16 dport1 } } +int +get_num_dsegs(struct tcp_graph *tg) +{ + int count; + struct segment *tmp; + + for (tmp=tg->segments, count=0; tmp; tmp=tmp->next) { + if (compare_headers(&tg->src_address, &tg->dst_address, + tg->src_port, tg->dst_port, + &tmp->ip_src, &tmp->ip_dst, + tmp->th_sport, tmp->th_dport, + COMPARE_CURR_DIR)) { + count++; + } + } + return count; +} + +int +get_num_acks(struct tcp_graph *tg, int *num_sack_ranges) +{ + int count; + struct segment *tmp; + + for (tmp = tg->segments, count=0; tmp; tmp = tmp->next) { + if (!compare_headers(&tg->src_address, &tg->dst_address, + tg->src_port, tg->dst_port, + &tmp->ip_src, &tmp->ip_dst, + tmp->th_sport, tmp->th_dport, + COMPARE_CURR_DIR)) { + count++; + *num_sack_ranges += tmp->num_sack_ranges; + } + } + return count; +} + + typedef struct _th_t { int num_hdrs; -- cgit v1.2.1