object-introspection/oi
Jake Hillion 71e734b120 tbv2: calculate total memory footprint
Add the option to calculate total size (inclusive size) by wrapping the
existing iterator. This change provides a new iterator, `SizedIterator`, which
wraps an existing iterator and adds a new field `size` to the output element.

This is achieved with a two pass algorithm on the existing iterator:
1. Gather metadata for each element. This includes the total size up until that
   element and the range of elements that should be included in the size.
2. Return the result from the underlying iterator with the additional
   field.

This algorithm is `O(N)` time on the number of elements in the iterator and
`O(N)` time, storing 16 bytes per element. This isn't super expensive but is a
lot more than the current algorithm which requires close to constant space.
Because of this I've implemented it as a wrapper on the iterator rather than on
by default, though it is now on in every one of our integration test cases.

Test plan:
- Added to the integration tests for full coverage.
2024-01-04 09:21:35 +00:00
..
exporters tbv2: calculate total memory footprint 2024-01-04 09:21:35 +00:00
support tomlplusplus: compile header once 2023-05-30 16:43:10 +02:00
type_graph clangparser: mark incomplete arrays as incomplete without failing 2023-12-20 16:31:52 +00:00
types/test move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
CMakeLists.txt tbv2: calculate total memory footprint 2024-01-04 09:21:35 +00:00
CodeGen.cpp tbv2: account for duplicate types when emitting name providers 2023-12-20 16:14:48 +00:00
CodeGen.h oilgen: migrate to source parsing (#421) 2023-12-19 13:26:25 -08:00
Config.cpp clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
Config.h support 0 to many config files (#371) 2023-10-02 14:06:39 -06:00
ContainerInfo.cpp CodeGen v2: Enable independent running without CodeGen v1 2023-12-15 14:57:24 +00:00
ContainerInfo.h OICodeGen: Respect ContainerInfo::requiredFeatures 2023-11-16 18:11:14 +00:00
ContainerTypeEnum.h Implement Container V2 for std::unordered_multiset 2023-08-30 18:45:00 +02:00
Descs.cpp move src directory to oi (#134) 2023-04-26 16:20:53 +01:00
Descs.h move src directory to oi (#134) 2023-04-26 16:20:53 +01:00
DrgnUtils.cpp ensure oi_name is never a nullptr (#165) 2023-06-12 16:47:34 -07:00
DrgnUtils.h DrgnUtils: Add isSizeComplete and underlyingType helper functions 2023-05-24 15:57:18 +01:00
EnumBitset.h containers: add required features (#374) 2023-10-09 17:50:39 -04:00
Features.cpp collapse TreeBuilderV2 features 2023-11-13 19:43:03 +00:00
Features.h collapse TreeBuilderV2 features 2023-11-13 19:43:03 +00:00
FuncGen.cpp tbv2: add dynamic context passed through all functions (#410) 2023-11-16 08:03:32 -08:00
FuncGen.h collapse TreeBuilderV2 features 2023-11-13 19:43:03 +00:00
Headers.h Compile Time OIL for OIL v2 2023-08-30 04:28:02 -07:00
IntrospectionResult.cpp capture_keys: store dynamic type path components more efficiently 2023-12-14 16:05:33 +00:00
Metrics.cpp clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
Metrics.h move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
OICache.cpp add portability.h (#386) 2023-10-24 03:03:16 -07:00
OICache.h move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
OICodeGen.cpp Really, really make sure arrays have a name (#430) 2023-12-13 16:28:31 +00:00
OICodeGen.h remove oil v1 leftovers 2023-10-30 18:18:13 +00:00
OICompiler.cpp collapse TreeBuilderV2 features 2023-11-13 19:43:03 +00:00
OICompiler.h add range-v3 library 2023-11-13 18:42:04 +00:00
OID.cpp OID: Make CodeGen v2 (TypeGraph) the default 2023-12-14 17:42:03 +00:00
OIDebugger.cpp CodeGen v2: Enable independent running without CodeGen v1 2023-12-15 14:57:24 +00:00
OIDebugger.h jitlog: use a memfd and glog 2023-11-21 12:00:13 +00:00
OIGenerator.cpp oilgen: migrate to source parsing (#421) 2023-12-19 13:26:25 -08:00
OIGenerator.h oilgen: migrate to source parsing (#421) 2023-12-19 13:26:25 -08:00
OILexer.h move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
OILexer.l move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
OILibrary.cpp oil v2 2023-08-23 15:59:53 +01:00
OILibraryImpl.cpp collapse TreeBuilderV2 features 2023-11-13 19:43:03 +00:00
OILibraryImpl.h oil v2 2023-08-23 15:59:53 +01:00
OIOpts.h move src directory to oi (#134) 2023-04-26 16:20:53 +01:00
OIParser.h clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
OIParser.yy move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
OITraceCode.cpp tbv2: add dynamic context passed through all functions (#410) 2023-11-16 08:03:32 -08:00
PaddingHunter.cpp clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
PaddingHunter.h move src directory to oi (#134) 2023-04-26 16:20:53 +01:00
Portability.h add portability.h (#386) 2023-10-24 03:03:16 -07:00
Serialize.cpp Update drgn to Omar's branch 2023-12-13 11:59:21 +00:00
Serialize.h Update drgn to Omar's branch 2023-12-13 11:59:21 +00:00
SymbolService.cpp clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
SymbolService.h oil v2 2023-08-23 15:59:53 +01:00
Syscall.h jitlog: use a memfd and glog 2023-11-21 12:00:13 +00:00
TimeUtils.h move src directory to oi (#134) 2023-04-26 16:20:53 +01:00
TrapInfo.h move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
TreeBuilder.cpp clang-format: disable bin packing 2023-11-13 18:19:53 +00:00
TreeBuilder.h move all internal logic to oi::detail namespace 2023-07-26 18:01:38 +01:00
TypeHierarchy.h clean up common.h 2023-06-09 13:15:17 +02:00
X86InstDefs.h move src directory to oi (#134) 2023-04-26 16:20:53 +01:00