diff options
author | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-02-01 20:52:38 +0000 |
---|---|---|
committer | etxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-02-01 20:52:38 +0000 |
commit | fc368278a8df978eb52b790dbfb934786e0b22dd (patch) | |
tree | 8cd6a200921086aea9c10375e08be754a5c0de70 /tap-sipstat.c | |
parent | 1be41eab9b564e746a74df4f658184dff8bd521c (diff) |
Calculate the avrage setuptime.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27342 f5534014-38df-0310-8fa8-9805f1628bb7
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"); } |