aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2012-09-23 16:25:28 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2012-09-23 16:25:28 +0000
commit72ca9d0e614945d09322a2210cb43f2ec41554c6 (patch)
treeeface143fd680320fa924d005e676b85f64e72e6 /rawshark.c
parent9cde3e1a44e874ac5beb9e539dd4819a1281a096 (diff)
Store pointers to previously displayed and captured packet, not nstime_t deltas.
This commit reduces size (from 144B to 128B on AMD64) of frame_data structure. Part of bug 5821: Reduce per-packet memory requirements. svn path=/trunk/; revision=45071
Diffstat (limited to 'rawshark.c')
-rw-r--r--rawshark.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/rawshark.c b/rawshark.c
index 7df9475fb2..d6f319ab76 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -120,8 +120,10 @@ static const gchar decode_as_arg_template[] = "<layer_type>==<selector>,<decode_
static guint32 cum_bytes;
static nstime_t first_ts;
-static nstime_t prev_dis_ts;
-static nstime_t prev_cap_ts;
+static frame_data *prev_dis;
+static frame_data prev_dis_frame;
+static frame_data *prev_cap;
+static frame_data prev_cap_frame;
/*
* The way the packet decode is to be written.
@@ -1063,7 +1065,7 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
printf("%lu", (unsigned long int) cf->count);
frame_data_set_before_dissect(&fdata, &cf->elapsed_time,
- &first_ts, &prev_dis_ts, &prev_cap_ts);
+ &first_ts, prev_dis, prev_cap);
/* We only need the columns if we're printing packet info but we're
*not* verbose; in verbose mode, we print the protocol tree, not
@@ -1072,7 +1074,12 @@ process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
tap_push_tapped_queue(&edt);
- frame_data_set_after_dissect(&fdata, &cum_bytes, &prev_dis_ts);
+ frame_data_set_after_dissect(&fdata, &cum_bytes);
+ prev_dis_frame = fdata;
+ prev_dis = &prev_dis_frame;
+
+ prev_cap_frame = fdata;
+ prev_cap = &prev_cap_frame;
for(i = 0; i < n_rfilters; i++) {
/* Run the read filter if we have one. */
@@ -1587,8 +1594,8 @@ raw_cf_open(capture_file *cf, const char *fname)
cf->snap = WTAP_MAX_PACKET_SIZE;
nstime_set_zero(&cf->elapsed_time);
nstime_set_unset(&first_ts);
- nstime_set_unset(&prev_dis_ts);
- nstime_set_unset(&prev_cap_ts);
+ prev_dis = NULL;
+ prev_cap = NULL;
return CF_OK;
}