aboutsummaryrefslogtreecommitdiffstats
path: root/epan/frame_data.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-12-26 18:26:24 -0800
committerGuy Harris <guy@alum.mit.edu>2018-12-27 04:34:29 +0000
commit7eb3e47fa49806ea2cf59f0fa009240fae049a2b (patch)
treed668ff9ceae57934fe33582457fc5169f6e764ba /epan/frame_data.h
parentc3a7986b86f5355e6bd1791f70b78c91bcdac247 (diff)
Try to squeeze some bytes out of the frame_data structure.
Make the time stamp precision a 4-bit bitfield, so, when combined with the other bitfields, we have 32 bits. That means we put the flags at the same structure level as the time stamp precision, so they can be combined; that gets rid of an extra "flags." for references to the flags. Put the two pointers next to each other, and after a multiple of 8 bytes worth of other fields, so that there's no padding before or between them. It's still not down to 64 bytes, which is the next lower power of 2, so there's more work to do. Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe Reviewed-on: https://code.wireshark.org/review/31213 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/frame_data.h')
-rw-r--r--epan/frame_data.h54
1 files changed, 33 insertions, 21 deletions
diff --git a/epan/frame_data.h b/epan/frame_data.h
index 4da31019f2..d4b429b596 100644
--- a/epan/frame_data.h
+++ b/epan/frame_data.h
@@ -24,7 +24,7 @@ extern "C" {
struct _packet_info;
struct epan_session;
-#define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->flags.visited)
+#define PINFO_FD_VISITED(pinfo) ((pinfo)->fd->visited)
/** @file
* Low-level frame data and metadata.
@@ -47,35 +47,47 @@ typedef enum {
/** The frame number is the ordinal number of the frame in the capture, so
it's 1-origin. In various contexts, 0 as a frame number means "frame
- number unknown". */
+ number unknown".
+
+ There is one of these structures for every frame in the capture.
+ That means a lot of memory if we have a lot of frames.
+ They are packed into power-of-2 chunks, so their size is effectively
+ rounded up to a power of 2.
+ Try to keep it close to, and less than or equal to, a power of 2.
+ "Smaller than a power of 2" is OK for ILP32 platforms.
+
+ XXX - shuffle the fields to try to keep the most commonly-accessed
+ fields within the first 16 or 32 bytes, so they all fit in a cache
+ line? */
struct _color_filter; /* Forward */
DIAG_OFF_PEDANTIC
typedef struct _frame_data {
- GSList *pfd; /**< Per frame proto data */
guint32 num; /**< Frame number */
guint32 pkt_len; /**< Packet length */
guint32 cap_len; /**< Amount actually captured */
guint32 cum_bytes; /**< Cumulative bytes into the capture */
gint64 file_off; /**< File offset */
- guint16 subnum; /**< subframe number, for protocols that require this */
- gint16 tsprec; /**< Time stamp precision */
- struct {
- unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
- unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
- /* Do NOT use packet_char_enc enum here: MSVC compiler does not handle an enum in a bit field properly */
- unsigned int encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */
- unsigned int visited : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
- unsigned int marked : 1; /**< 1 = marked by user, 0 = normal */
- unsigned int ref_time : 1; /**< 1 = marked as a reference time frame, 0 = normal */
- unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */
- unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */
- unsigned int has_phdr_comment : 1; /** 1 = there's comment for this packet */
- unsigned int has_user_comment : 1; /** 1 = user set (also deleted) comment for this packet */
- unsigned int need_colorize : 1; /**< 1 = need to (re-)calculate packet color */
- } flags;
-
+ /* These two are pointers, meaning 64-bit on LP64 (64-bit UN*X) and
+ LLP64 (64-bit Windows) platforms. Put them here, one after the
+ other, so they don't require padding between them. */
+ GSList *pfd; /**< Per frame proto data */
const struct _color_filter *color_filter; /**< Per-packet matching color_filter_t object */
-
+ guint16 subnum; /**< subframe number, for protocols that require this */
+ /* Keep the bitfields below to 16 bits, so this plus the previous field
+ are 32 bits. */
+ unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */
+ unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */
+ /* Do NOT use packet_char_enc enum here: MSVC compiler does not handle an enum in a bit field properly */
+ unsigned int encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */
+ unsigned int visited : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/
+ unsigned int marked : 1; /**< 1 = marked by user, 0 = normal */
+ unsigned int ref_time : 1; /**< 1 = marked as a reference time frame, 0 = normal */
+ unsigned int ignored : 1; /**< 1 = ignore this frame, 0 = normal */
+ unsigned int has_ts : 1; /**< 1 = has time stamp, 0 = no time stamp */
+ unsigned int has_phdr_comment : 1; /** 1 = there's comment for this packet */
+ unsigned int has_user_comment : 1; /** 1 = user set (also deleted) comment for this packet */
+ unsigned int need_colorize : 1; /**< 1 = need to (re-)calculate packet color */
+ unsigned int tsprec : 4; /**< Time stamp precision -2^tsprec gives up to femtoseconds */
nstime_t abs_ts; /**< Absolute timestamp */
nstime_t shift_offset; /**< How much the abs_tm of the frame is shifted */
guint32 frame_ref_num; /**< Previous reference frame (0 if this is one) */