mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Fix DataBlockList::DataSize()
Parameters got filled opposite to what they were supposed to be and also didn't consider cutoffs that land in the middle of a block.
This commit is contained in:
parent
e30035910e
commit
5ce68bd20a
2 changed files with 14 additions and 5 deletions
|
@ -24,9 +24,17 @@ void DataBlockList::DataSize(uint64_t seq_cutoff, uint64_t* below, uint64_t* abo
|
|||
const auto& b = e.second;
|
||||
|
||||
if ( b.seq <= seq_cutoff )
|
||||
*above += b.Size();
|
||||
else
|
||||
{
|
||||
if ( b.upper <= seq_cutoff )
|
||||
*below += b.Size();
|
||||
else
|
||||
{
|
||||
*below += seq_cutoff - b.seq;
|
||||
*above += b.upper - seq_cutoff;
|
||||
}
|
||||
}
|
||||
else
|
||||
*above += b.Size();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,12 +155,13 @@ public:
|
|||
{ return total_data_size; }
|
||||
|
||||
/**
|
||||
* Counts the total size of all list elements paritioned by some cuttof.
|
||||
* Counts the total size of all data contained in list elements
|
||||
* partitioned by some cutoff.
|
||||
* WARNING: this is an O(n) operation and potentially very slow.
|
||||
* @param seq_cutoff the sequence number used to partition
|
||||
* element sizes returned via "below" and "above" parameters
|
||||
* @param below the size in bytes of all elements below "seq_cutoff"
|
||||
* @param above the size in bytes of all elements above "seq_cutoff"
|
||||
* @param below the size in bytes of all data below "seq_cutoff"
|
||||
* @param above the size in bytes of all data above "seq_cutoff"
|
||||
*/
|
||||
void DataSize(uint64_t seq_cutoff, uint64_t* below, uint64_t* above) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue