diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2008-01-27 18:19:40 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2008-01-27 18:19:40 +0000 |
commit | 649abbb0fefc50aabda7eb1049c8dad3e99cabd2 (patch) | |
tree | 0d4c5a224d2638737214306332bedba5da2272e4 /gtk/io_stat.c | |
parent | 8ca53280804e27045011b2fa72db5f82e37e2059 (diff) |
When having more than one matching item in a frame the AVG calculation
did not return a correct value.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24210 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/io_stat.c')
-rw-r--r-- | gtk/io_stat.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gtk/io_stat.c b/gtk/io_stat.c index 786b0fea90..2e6605b0e1 100644 --- a/gtk/io_stat.c +++ b/gtk/io_stat.c @@ -448,7 +448,7 @@ get_it_value(io_stat_t *io, int graph_id, int idx) break; case CALC_TYPE_AVG: if(it->frames){ - value=it->int_tot/it->frames; + value=(it->int_max+it->int_min)/2; } else { value=0; } @@ -473,11 +473,13 @@ get_it_value(io_stat_t *io, int graph_id, int idx) break; case CALC_TYPE_AVG: if(it->frames){ - guint64 t; /* time in us */ + guint64 t1, t2; /* time in us */ - t=it->time_tot.secs; - t=t*1000000+it->time_tot.nsecs/1000; - value=(guint32) (t/it->frames); + t1=it->time_max.secs; + t1=t1*1000000+it->time_max.nsecs/1000; + t2=it->time_min.secs; + t2=t2*1000000+it->time_min.nsecs/1000; + value=(guint32) ((t1+t2)/2); } else { value=0; } |