aboutsummaryrefslogtreecommitdiffstats
path: root/summary.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-02-26 08:02:02 +0000
committerGuy Harris <guy@alum.mit.edu>2012-02-26 08:02:02 +0000
commit30b86b78178e111747eaf605925cce289483b98d (patch)
tree1dd8940d5ab0c55943f42d9126506f21691b3cc5 /summary.c
parent08d7ff268bc91be4a210006b1f8ed2dae67c4391 (diff)
Suppress invalid or non-meaningful statistics - for example, without
time stamps on all packets in a set, you can't determine the start and end time of the packets in the set (even one timestampless packet throws the determination off - was that packet before the first time-stamped or after the last time-stamped packet, or between them?). svn path=/trunk/; revision=41187
Diffstat (limited to 'summary.c')
-rw-r--r--summary.c88
1 files changed, 55 insertions, 33 deletions
diff --git a/summary.c b/summary.c
index 221d76a..1341062 100644
--- a/summary.c
+++ b/summary.c
@@ -43,48 +43,67 @@ tally_frame_data(frame_data *cur_frame, summary_tally *sum_tally)
{
double cur_time;
- cur_time = nstime_to_sec(&cur_frame->abs_ts);
-
- if (cur_time < sum_tally->start_time) {
- sum_tally->start_time = cur_time;
- }
- if (cur_time > sum_tally->stop_time){
- sum_tally->stop_time = cur_time;
- }
sum_tally->bytes += cur_frame->pkt_len;
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->filtered_start = 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 ;
+ sum_tally->filtered_bytes += cur_frame->pkt_len;
}
if (cur_frame->flags.marked){
- if (sum_tally->marked_count==0){
- sum_tally->marked_start= cur_time;
- sum_tally->marked_stop = cur_time;
- } else {
- if (cur_time < sum_tally->marked_start) {
- sum_tally->marked_start = cur_time;
- }
- if (cur_time > sum_tally->marked_stop) {
- sum_tally->marked_stop = cur_time;
- }
- }
sum_tally->marked_count++;
- sum_tally->marked_bytes += cur_frame->pkt_len ;
+ sum_tally->marked_bytes += cur_frame->pkt_len;
}
if (cur_frame->flags.ignored){
sum_tally->ignored_count++;
}
+
+ if (cur_frame->flags.has_ts) {
+ /* This packet has a time stamp. */
+ cur_time = nstime_to_sec(&cur_frame->abs_ts);
+
+ sum_tally->packet_count_ts++;
+ if (cur_time < sum_tally->start_time) {
+ sum_tally->start_time = cur_time;
+ }
+ if (cur_time > sum_tally->stop_time){
+ sum_tally->stop_time = cur_time;
+ }
+ if (cur_frame->flags.passed_dfilter){
+ sum_tally->filtered_count_ts++;
+ /*
+ * If we've seen one filtered packet, this is the first
+ * one.
+ */
+ if (sum_tally->filtered_count == 1){
+ sum_tally->filtered_start= cur_time;
+ sum_tally->filtered_stop = cur_time;
+ } else {
+ if (cur_time < sum_tally->filtered_start) {
+ sum_tally->filtered_start = cur_time;
+ }
+ if (cur_time > sum_tally->filtered_stop) {
+ sum_tally->filtered_stop = cur_time;
+ }
+ }
+ }
+ if (cur_frame->flags.marked){
+ sum_tally->marked_count_ts++;
+ /*
+ * If we've seen one marked packet, this is the first
+ * one.
+ */
+ if (sum_tally->marked_count == 1){
+ sum_tally->marked_start= cur_time;
+ sum_tally->marked_stop = cur_time;
+ } else {
+ if (cur_time < sum_tally->marked_start) {
+ sum_tally->marked_start = cur_time;
+ }
+ if (cur_time > sum_tally->marked_stop) {
+ sum_tally->marked_stop = cur_time;
+ }
+ }
+ }
+ }
}
void
@@ -95,14 +114,17 @@ summary_fill_in(capture_file *cf, summary_tally *st)
guint32 framenum;
wtapng_section_t* shb_inf;
+ st->packet_count_ts = 0;
st->start_time = 0;
st->stop_time = 0;
st->bytes = 0;
st->filtered_count = 0;
+ st->filtered_count_ts = 0;
st->filtered_start = 0;
st->filtered_stop = 0;
st->filtered_bytes = 0;
st->marked_count = 0;
+ st->marked_count_ts = 0;
st->marked_start = 0;
st->marked_stop = 0;
st->marked_bytes = 0;
@@ -194,7 +216,7 @@ summary_fill_in_capture(capture_file *cf,capture_options *capture_opts, summary_
iface.linktype = wtapng_if_descr.link_type;
g_array_append_val(st->ifaces, iface);
}
- g_free(idb_info);
+ g_free(idb_info);
}
}
#endif