diff options
author | Anders Broman <anders.broman@ericsson.com> | 2009-02-01 20:52:38 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2009-02-01 20:52:38 +0000 |
commit | f9bb905d13385c1e2ad840e397136316130b2bec (patch) | |
tree | 8cd6a200921086aea9c10375e08be754a5c0de70 /tap-sipstat.c | |
parent | 64687d15edbffae083e9a7a2808a0588d8dd2a95 (diff) |
Calculate the avrage setuptime.
svn path=/trunk/; revision=27342
Diffstat (limited to 'tap-sipstat.c')
-rw-r--r-- | tap-sipstat.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tap-sipstat.c b/tap-sipstat.c index e96bd19926..4559f5a5b7 100644 --- a/tap-sipstat.c +++ b/tap-sipstat.c @@ -46,6 +46,7 @@ typedef struct _sip_stats_t { char *filter; guint32 packets; /* number of sip packets, including continuations */ guint32 resent_packets; + guint32 avrage_setup_time; GHashTable *hash_responses; GHashTable *hash_requests; } sipstat_t; @@ -214,6 +215,7 @@ sipstat_reset(void *psp ) if (sp) { sp->packets = 0; sp->resent_packets = 0; + sp->avrage_setup_time = 0; g_hash_table_foreach( sp->hash_responses, (GHFunc)sip_reset_hash_responses, NULL); g_hash_table_foreach( sp->hash_requests, (GHFunc)sip_reset_hash_requests, NULL); } @@ -229,6 +231,15 @@ sipstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const /* Total number of packets, including continuation packets */ sp->packets++; + + /* Calculate avrage setup time */ + if (value->setup_time){ + /* Check if it's the first value */ + if ( sp->avrage_setup_time == 0 ){ + sp->avrage_setup_time = value->setup_time; + } + sp->avrage_setup_time = (sp->avrage_setup_time + value->setup_time)/2; + } /* Update resent count if flag set */ if (value->resend) @@ -345,6 +356,7 @@ sipstat_draw(void *psp ) printf("\n* List of SIP Request methods\n"); g_hash_table_foreach( sp->hash_requests, (GHFunc)sip_draw_hash_requests, " %-15s : %5d Packets\n"); + printf( "\n* Avrage setuptime %d ms\n", sp->avrage_setup_time); printf("===================================================================\n"); } |