From 9918dd2b90c1779186423906ce7e55b10e99eb66 Mon Sep 17 00:00:00 2001 From: pompolic <pompolic@special-circumstanc.es> Date: Wed, 25 Jan 2023 13:15:21 +0100 Subject: [PATCH] WIP commit (broken) --- gdb-port/top-level-parse.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index e8dc13e..6b3fa38 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -66,7 +66,7 @@ class TopLevelParse: #if self.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS if self.extended_arena_stats_available(): # DEBUG self.bytes_at_enter.append(arena['arena_malloc_bytes']) - self.cumulative_byte_differences = [] + self.cumulative_byte_differences = [] # TODO: direction try: parser_obj = self.parser_objs[parser] @@ -89,6 +89,10 @@ class TopLevelParse: if self.extended_arena_stats_available(): # DEBUG newbytes = parse_state['arena']['arena_malloc_bytes'] self.cumulative_byte_differences.insert(0, newbytes - self.bytes_at_enter[-(len(self.cumulative_byte_differences)+1)]) # TODO: consistency. this is the third way of answering the question, "how deep are we in the stack" + allocated_bytes = self.cumulative_byte_differences[-len(self.cumulative_byte_differences)] - self.cumulative_byte_differences[-(len(self.cumulative_byte_differences)-1)] # NB: len(self.cumulative_byte_differences) changed since the last line + self.total_byte_differences[-len(self.cumulative_byte_differences)] = allocated_bytes + parser_obj.add_mem_use(allocated_bytes) + # TODO: allocations can be attributed to individual h_do_parse(parser) calls, thus the same per-parser per-arena stats tracking can be done # Called from h_do_parse()'s handler, at which point we know the addresses of the state and arena def first_h_do_parse_after_packrat_parse(self, parse_state, arena): -- GitLab