diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-09-02 22:10:32 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-09-02 22:10:32 +0000 |
commit | 71034c5a3faef6c2305e8e1f9253d544f559a532 (patch) | |
tree | 2e61ed55c7483b1dc2f6e5841d0b78ecfa7f6757 | |
parent | a3a1ee88505d1650453c12c2aaa459f48795c0ec (diff) |
From Jean-Michel Fayard: show in Tools:Summary window statistics about
packets that passed the current display filter, as well as about the
entire capture.
Document the Tools:Summary item in the man page.
Update Gerald's e-mail address.
svn path=/trunk/; revision=8344
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | doc/ethereal.pod.template | 10 | ||||
-rw-r--r-- | gtk/summary_dlg.c | 64 | ||||
-rw-r--r-- | summary.c | 22 | ||||
-rw-r--r-- | summary.h | 10 |
5 files changed, 95 insertions, 16 deletions
@@ -1811,6 +1811,11 @@ Vincent Jardin <vincent.jardin [AT] 6wind.com> { Support for TEREDO } +Jean-Michel Fayard <jean-michel.fayard [AT] moufrei.de> { + Show in Tools:Summary window statistics about packets that + passed the current display filter +} + And assorted fixes and enhancements by the people listed above and by: Pavel Roskin <proski [AT] gnu.org> diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index 1e2efe18a2..d0f06213d8 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -759,6 +759,13 @@ be used, for example, to go to the frame for the request corresponding to a reply, or the reply corresponding to a request, if that frame number has been put into the protocol tree. +=item Tools:Summary + +Show summary information about the capture, including elapsed time, +packet counts, byte counts, and the like. If a display filter is in +effect, summary information will be shown about the capture and about +the packets currently being displayed. + =item Tools:Protocol Hierarchy Statistics Show the number of packets, and the number of bytes in those packets, @@ -2047,6 +2054,8 @@ B<http://www.ethereal.com>. Niklas Ogren <niklas.ogren [AT] 71.se> Jesper Peterson <jesper [AT] endace.com> Giles Scott <gscott2 [AT] nortelnetworks.com> + Vincent Jardin <vincent.jardin [AT] 6wind.com> + Jean-Michel Fayard <jean-michel.fayard [AT] moufrei.de> Pavel Roskin <proski [AT] gnu.org> Georgi Guninski <guninski [AT] guninski.com> Jason Copenhaver <jcopenha [AT] typedef.org> @@ -2064,7 +2073,6 @@ B<http://www.ethereal.com>. Chris Heath <chris [AT] heathens.co.nz> Loïc Minier <lool [AT] dooz.org> Gisle Vanem <giva [AT] bgnett.no> - Vincent Jardin <vincent.jardin@6wind.com> Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to give his permission to use his version of snprintf.c. diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c index 24da6b450a..841de24c39 100644 --- a/gtk/summary_dlg.c +++ b/gtk/summary_dlg.c @@ -1,13 +1,12 @@ /* summary_dlg.c * Routines for capture file summary window * - * $Id: summary_dlg.c,v 1.18 2003/03/07 20:27:02 gerald Exp $ + * $Id: summary_dlg.c,v 1.19 2003/09/02 22:10:32 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -23,7 +22,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -62,6 +60,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) summary_tally summary; GtkWidget *sum_open_w, *main_vb, *file_fr, *data_fr, *capture_fr, *file_box, + *filter_box, *filter_fr, *data_box, *capture_box, *bbox, *close_bt; gchar string_buff[SUM_STR_MAX]; @@ -131,8 +130,9 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) add_string_to_box(string_buff, data_box); /* Filtered Packet count */ - snprintf(string_buff, SUM_STR_MAX, "Filtered packet count: %i", summary.filtered_count); - add_string_to_box(string_buff, data_box); + /* Unless there is none filter, we move informations about filtered packets in a separate frame */ + if (!summary.dfilter) + add_string_to_box("Filtered packet count: 0", data_box); /* Marked Packet count */ snprintf(string_buff, SUM_STR_MAX, "Marked packet count: %i", summary.marked_count); @@ -169,7 +169,56 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) add_string_to_box(string_buff, data_box); } - /* Capture frame */ + /* Filter frame */ + if (summary.dfilter) { + double seconds; + + seconds = (summary.filtered_stop - summary.filtered_start); + + /* Filtered packets frame */ + filter_fr = gtk_frame_new("Data in filtered packets"); + gtk_container_add(GTK_CONTAINER(main_vb), filter_fr); + gtk_widget_show(filter_fr); + + filter_box = gtk_vbox_new( FALSE, 3); + gtk_container_add(GTK_CONTAINER(filter_fr), filter_box); + gtk_widget_show(filter_box); + + /* seconds */ + snprintf(string_buff, SUM_STR_MAX, "Between first and last packet: %.3f seconds", seconds); + add_string_to_box(string_buff, filter_box); + + /* Packet count */ + snprintf(string_buff, SUM_STR_MAX, "Packet count: %i", summary.filtered_count); + add_string_to_box(string_buff, filter_box); + + /* Packets per second */ + if (seconds > 0){ + snprintf(string_buff, SUM_STR_MAX, "Avg. packets/sec: %.3f", summary.filtered_count/seconds); + add_string_to_box(string_buff, filter_box); + } + + /* Packet size */ + snprintf(string_buff, SUM_STR_MAX, "Avg. packet size: %.3f bytes", (float) summary.filtered_bytes/summary.filtered_count); + add_string_to_box(string_buff, filter_box); + + /* Byte count */ + snprintf(string_buff, SUM_STR_MAX, "Bytes of traffic: %d", summary.filtered_bytes); + add_string_to_box(string_buff, filter_box); + + /* Bytes per second */ + if (seconds > 0){ + snprintf(string_buff, SUM_STR_MAX, "Avg. bytes/sec: %.3f", summary.filtered_bytes/seconds); + add_string_to_box(string_buff, filter_box); + + /* MBit per second */ + snprintf(string_buff, SUM_STR_MAX, "Avg. Mbit/sec: %.3f", + summary.filtered_bytes * 8.0 / (seconds * 1000.0 * 1000.0)); + add_string_to_box(string_buff, filter_box); + } + } + + /* Capture Frame */ capture_fr = gtk_frame_new("Capture"); gtk_container_add(GTK_CONTAINER(main_vb), capture_fr); gtk_widget_show(capture_fr); @@ -178,7 +227,6 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) gtk_container_add(GTK_CONTAINER(capture_fr), capture_box); gtk_widget_show(capture_box); - /* interface */ if (summary.iface) { snprintf(string_buff, SUM_STR_MAX, "Interface: %s", summary.iface); @@ -1,7 +1,7 @@ /* summary.c * Routines for capture file summary info * - * $Id: summary.c,v 1.22 2002/02/08 10:07:34 guy Exp $ + * $Id: summary.c,v 1.23 2003/09/02 22:10:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -51,8 +51,21 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally) sum_tally->stop_time = cur_time; } sum_tally->bytes += cur_frame->pkt_len; - if (cur_frame->flags.passed_dfilter) + if (cur_frame->flags.passed_dfilter){ + if (sum_tally->filtered_count==0){ + sum_tally->filtered_start= cur_time; + sum_tally->filtered_stop = cur_time; + } else { + if (cur_time < sum_tally->filtered_start) { + sum_tally->start_time = cur_time; + } + if (cur_time > sum_tally->filtered_stop) { + sum_tally->filtered_stop = cur_time; + } + } sum_tally->filtered_count++; + sum_tally->filtered_bytes += cur_frame->pkt_len ; + } if (cur_frame->flags.marked) sum_tally->marked_count++; @@ -70,12 +83,15 @@ summary_fill_in(summary_tally *st) st->stop_time = 0; st->bytes = 0; st->filtered_count = 0; + st->filtered_start = 0; + st->filtered_stop = 0; + st->filtered_bytes = 0; st->marked_count = 0; /* initialize the tally */ if (cfile.plist != NULL) { first_frame = cfile.plist; - st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs); + st->start_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs); st->stop_time = secs_usecs(first_frame->abs_secs,first_frame->abs_usecs); cur_glist = cfile.plist; @@ -1,13 +1,12 @@ /* summary.h * Definitions for capture file summary data * - * $Id: summary.h,v 1.7 2002/02/08 10:07:34 guy Exp $ + * $Id: summary.h,v 1.8 2003/09/02 22:10:32 guy Exp $ * * Ethereal - Network traffic analyzer - * By Gerald Combs <gerald@zing.org> + * By Gerald Combs <gerald@ethereal.com> * Copyright 1998 Gerald Combs * - * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -33,9 +32,12 @@ typedef struct _summary_tally { double elapsed_time; /* seconds, with msec resolution, includes time before first packet and after last packet */ - int filtered_count; /* number of filtered packets */ int marked_count; /* number of marked packets */ int packet_count; /* total number of packets in trace */ + int filtered_count; /* number of filtered packets */ + guint32 filtered_bytes; /* total bytes in the filtered packets */ + double filtered_start; /* time in seconds, with msec resolution */ + double filtered_stop; /* time in seconds, with msec resolution */ const char *filename; long file_length; /* file length in bytes */ int encap_type; /* wiretap encapsulation type */ |