Pack some classes for better memory usages

- Analyzer: Reduce from 208 bytes to 192 bytes, remove one cache line
- EventGroup: Reduce from 104 bytes to 96 bytes
- Packet: Reduce from 200 bytes to 184 bytes, remove one cache line
- threading::Value: Reduce from 48 bytes to 40 bytes
- ConnTuple: push hole to the end of struct
- TCP_Reassembler: Reduce from 240 bytes to 232 bytes
This commit is contained in:
Tim Wojtulewicz 2025-01-27 11:09:57 -07:00
parent 99023b14d5
commit 572adf3f23
6 changed files with 34 additions and 33 deletions

View file

@ -160,16 +160,6 @@ public:
*/
uint32_t eth_type;
/**
* Layer 2 source address.
*/
const u_char* l2_src = nullptr;
/**
* Layer 2 destination address.
*/
const u_char* l2_dst = nullptr;
/**
* (Outermost) VLAN tag if any, else 0.
*/
@ -208,6 +198,24 @@ public:
*/
bool l4_checksummed = false;
/**
* Layer 2 source address.
*/
const u_char* l2_src = nullptr;
/**
* Layer 2 destination address.
*/
const u_char* l2_dst = nullptr;
/**
* This flag indicates whether a packet has been processed. This can
* mean different things depending on the traffic, but generally it
* means that a packet has been logged in some way. We default to
* false, and this can be set to true for any number of reasons.
*/
bool processed = false;
/**
* Indicates whether this packet should be recorded.
*/
@ -264,14 +272,6 @@ public:
*/
int gre_link_type = DLT_RAW;
/**
* This flag indicates whether a packet has been processed. This can
* mean different things depending on the traffic, but generally it
* means that a packet has been logged in some way. We default to
* false, and this can be set to true for any number of reasons.
*/
bool processed = false;
/**
* The session related to this packet, if one exists.
*/
@ -283,7 +283,7 @@ private:
// True if we need to delete associated packet memory upon
// destruction.
bool copy;
bool copy = false;
};
} // namespace zeek