summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorCal Turney <cal.turney@emc.com>2013-08-09 14:53:35 +0000
committerCal Turney <cal.turney@emc.com>2013-08-09 14:53:35 +0000
commit249285a022ffd8423076da505d0236870d1af683 (patch)
tree6be4f74fb5d7659d1b5756c6fbdb3ea25d958292 /ui
parent5ffa911a6bb322e5473b229ce4cc480c431a9982 (diff)
downloadwireshark-249285a022ffd8423076da505d0236870d1af683.tar.gz
Patch for bug 9014. If the relative time is negative, it is set to that of the previous packet. Since the packet is not discarded, its metadata is included in the stats.
svn path=/trunk/; revision=51236
Diffstat (limited to 'ui')
-rw-r--r--ui/cli/tap-iostat.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/ui/cli/tap-iostat.c b/ui/cli/tap-iostat.c
index 667377d4a2..4bc2dc5efb 100644
--- a/ui/cli/tap-iostat.c
+++ b/ui/cli/tap-iostat.c
@@ -91,6 +91,8 @@ typedef struct _io_stat_item_t {
#define NANOSECS_PER_SEC 1000000000ULL
+static guint64 last_relative_time;
+
static int
iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *dummy _U_)
{
@@ -105,21 +107,24 @@ iostat_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt, const void *du
mit = (io_stat_item_t *) arg;
parent = mit->parent;
- relative_time = ((guint64)pinfo->rel_ts.secs * 1000000ULL) +
- ((guint64)((pinfo->rel_ts.nsecs+500)/1000));
+
+ /* If this frame's relative time is negative, set its relative time to last_relative_time
+ rather than disincluding it from the calculations. */
+ if (pinfo->rel_ts.secs >= 0) {
+ relative_time = ((guint64)pinfo->rel_ts.secs * 1000000ULL) +
+ ((guint64)((pinfo->rel_ts.nsecs+500)/1000));
+ last_relative_time = relative_time;
+ } else {
+ relative_time = last_relative_time;
+ }
+
if (mit->parent->start_time == 0) {
mit->parent->start_time = pinfo->fd->abs_ts.secs - pinfo->rel_ts.secs;
}
- /* The prev item before the main one is always the last interval we saw packets for */
+ /* The prev item is always the last interval in which we saw packets. */
it = mit->prev;
- /* XXX for the time being, just ignore all frames that are in the past.
- should be fixed in the future but hopefully it is uncommon */
- if(relative_time < it->time){
- return FALSE;
- }
-
/* If we have moved into a new interval (row), create a new io_stat_item_t struct for every interval
* between the last struct and this one. If an item was not found in a previous interval, an empty
* struct will be created for it. */
@@ -937,8 +942,13 @@ iostat_draw(void *arg)
full_fmt = g_strconcat("| ", invl_fmt, " <> ", invl_fmt, " |", NULL);
else
full_fmt = g_strconcat("| ", invl_fmt, " <> ", invl_fmt, " |", NULL);
- num_rows = (int)(duration/interval) + (duration%interval > 0 ? 1 : 0);
-
+
+ if (interval == 0 || duration == 0) {
+ num_rows = 0;
+ } else {
+ num_rows = (int)(duration/interval) + ((int)(duration%interval) > 0 ? 1 : 0);
+ }
+
/* Load item_in_column with the first item in each column */
item_in_column = (io_stat_item_t **) g_malloc(sizeof(io_stat_item_t *) * num_cols);
for (j=0; j<num_cols; j++) {