mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
simpler public calling interface for computing footprint
This commit is contained in:
parent
15123b6768
commit
7fd94f82a8
2 changed files with 13 additions and 4 deletions
11
src/Val.h
11
src/Val.h
|
@ -127,6 +127,17 @@ public:
|
||||||
* The number is not meant to be precise, but rather comparable:
|
* The number is not meant to be precise, but rather comparable:
|
||||||
* larger footprint correlates with more memory consumption.
|
* larger footprint correlates with more memory consumption.
|
||||||
*
|
*
|
||||||
|
* @return The total footprint.
|
||||||
|
*/
|
||||||
|
unsigned int Footprint() const
|
||||||
|
{
|
||||||
|
std::set<const RecordVal*> analyzed_records;
|
||||||
|
return Footprint(&analyzed_records);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal function for computing a Val's "footprint".
|
||||||
|
*
|
||||||
* @param analyzed_records A pointer to a set used to track which
|
* @param analyzed_records A pointer to a set used to track which
|
||||||
* records have been analyzed to date, used to prevent infinite
|
* records have been analyzed to date, used to prevent infinite
|
||||||
* recursion. The set should be empty (but not nil) on the first call.
|
* recursion. The set should be empty (but not nil) on the first call.
|
||||||
|
|
|
@ -2008,8 +2008,7 @@ function global_container_footprints%(%): var_sizes
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto id_name = zeek::make_intrusive<zeek::StringVal>(id->Name());
|
auto id_name = zeek::make_intrusive<zeek::StringVal>(id->Name());
|
||||||
std::set<const RecordVal*> analyzed_records;
|
auto fp = zeek::val_mgr->Count(v->Footprint());
|
||||||
auto fp = zeek::val_mgr->Count(v->Footprint(&analyzed_records));
|
|
||||||
sizes->Assign(std::move(id_name), std::move(fp));
|
sizes->Assign(std::move(id_name), std::move(fp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2025,8 +2024,7 @@ function global_container_footprints%(%): var_sizes
|
||||||
## .. zeek:see:: global_container_footprints
|
## .. zeek:see:: global_container_footprints
|
||||||
function val_footprint%(v: any%): count
|
function val_footprint%(v: any%): count
|
||||||
%{
|
%{
|
||||||
std::set<const RecordVal*> analyzed_records;
|
return zeek::val_mgr->Count(v->Footprint());
|
||||||
return zeek::val_mgr->Count(v->Footprint(&analyzed_records));
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Generates a table with information about all global identifiers. The table
|
## Generates a table with information about all global identifiers. The table
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue