mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
added value_footprint() and global_container_footprints() BiFs
This commit is contained in:
parent
02771168f0
commit
16c37034de
5 changed files with 287 additions and 0 deletions
20
src/Val.h
20
src/Val.h
|
@ -121,6 +121,18 @@ public:
|
|||
// size depends on the Val's type.
|
||||
virtual ValPtr SizeVal() const;
|
||||
|
||||
/**
|
||||
* Returns the Val's "footprint", i.e., how many atomic (non-container)
|
||||
* values it includes, either directly or indirectly.
|
||||
*
|
||||
* @param count_entries If true, (recursively) include in the
|
||||
* footprint the count of the number of container elements as well
|
||||
* as each element's footprint.
|
||||
*
|
||||
* @return The total footprint, optionally including element counts.
|
||||
*/
|
||||
virtual unsigned int Footprint(bool count_entries) const { return 1; }
|
||||
|
||||
// Bytes in total value object.
|
||||
[[deprecated("Remove in v5.1. MemoryAllocation() is deprecated and will be removed. See "
|
||||
"GHI-572.")]] virtual unsigned int
|
||||
|
@ -666,6 +678,8 @@ public:
|
|||
|
||||
void Describe(ODesc* d) const override;
|
||||
|
||||
unsigned int Footprint(bool count_entries) const override;
|
||||
|
||||
[[deprecated("Remove in v5.1. MemoryAllocation() is deprecated and will be removed. See "
|
||||
"GHI-572.")]] unsigned int
|
||||
MemoryAllocation() const override;
|
||||
|
@ -941,6 +955,8 @@ public:
|
|||
// the function in the frame allowing it to capture its closure.
|
||||
void InitDefaultFunc(detail::Frame* f);
|
||||
|
||||
unsigned int Footprint(bool count_entries) const override;
|
||||
|
||||
[[deprecated("Remove in v5.1. MemoryAllocation() is deprecated and will be removed. See "
|
||||
"GHI-572.")]] unsigned int
|
||||
MemoryAllocation() const override;
|
||||
|
@ -1367,6 +1383,8 @@ public:
|
|||
}
|
||||
RecordValPtr CoerceTo(RecordTypePtr other, bool allow_orphaning = false);
|
||||
|
||||
unsigned int Footprint(bool count_entries) const override;
|
||||
|
||||
[[deprecated("Remove in v5.1. MemoryAllocation() is deprecated and will be removed. See "
|
||||
"GHI-572.")]] unsigned int
|
||||
MemoryAllocation() const override;
|
||||
|
@ -1624,6 +1642,8 @@ public:
|
|||
const auto& RawYieldType() const { return yield_type; }
|
||||
const auto& RawYieldTypes() const { return yield_types; }
|
||||
|
||||
unsigned int Footprint(bool count_entries) const override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns the element at a given index or nullptr if it does not exist.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue