diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 34d8e29c97cb06c28453473f22c0a674a9790a7c..ff10bceb79fe8bbc320ea409907dac2acedc8f9c 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -92,9 +92,6 @@ class ParserStack: self.p_stack = [] self.unclaimed_mem_use = 0 self.partial_alloc_counts = [] - self.bytes_at_enter = [] - self.cumulative_byte_differences = [] - self.total_byte_differences = [] self.stack_events = [] # Represents the index of a "waterline" on the stack_events for the purpose of counting allocations # This is the index of the last event (stack push or pop) where the relevant allocations have been committed to TopLevelParse's memory stats. @@ -136,13 +133,9 @@ class ParserStack: self.partial_alloc_counts.append(None) if self.top_level_parse.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS: #TODO: check that self.arena is same as gdb.selected_frame()'s arena - self.bytes_at_enter.append(int(self.arena_gdbval['arena_malloc_bytes'])) self.cumulative_byte_differences = [] self.stack_events.append((StackEvent.PUSH, int(self.arena_gdbval['arena_malloc_bytes']), parser)) prev = 0 - if len(self.bytes_at_enter) > 1: - prev = self.bytes_at_enter[-2] - thusfar = self.bytes_at_enter[-1] - prev #print("Bytes allocated since last h_do_parse:", thusfar, ", parser:", str(parser)) # DEBUG #import code; code.interact(local=locals()) # DEBUG #breakpoint() # DEBUG @@ -165,10 +158,6 @@ class ParserStack: #import code; code.interact(local=locals()) # DEBUG newbytes = int(self.parse_state_gdbval['arena']['arena_malloc_bytes']) self.stack_events.append((StackEvent.POP, int(self.parse_state_gdbval['arena']['arena_malloc_bytes']), parser_obj)) - # TODO: index expression with len() seems unnecessary - 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.insert(-len(self.cumulative_byte_differences), allocated_bytes) allocs = self.commit_at_pop() #print("adding mem use: parser:", str(parser_obj), "arena:", hex(int(self.arena)), "bytes:", allocated_bytes) # DEBUG