Skip to content
Snippets Groups Projects
Commit a37dc8a8 authored by pompolic's avatar pompolic
Browse files

More comments

parent 07356245
No related branches found
No related tags found
No related merge requests found
......@@ -275,13 +275,19 @@ class ParserStack:
print("push_allocations:", push_allocations) # DEBUG
print("push_allocations_with_names:", {parser.name: pushes[index+1][1]-pushes[index][1] for index, parser in enumerate(parsers)}) # DEBUG
# TODO: looks like it needs to account for the case where top of stack is a string of pushes, but there are runs of pushes without corresponding pops (yet?) deeper in the stack
# TODO: seems this is possible, but check if it really is:
#print("all stack events:", self.stack_events) # DEBUG
print("top 30 stack events:", [ev[0] for ev in self.stack_events[-30:]]) # DEBUG
#for index, ev in enumerate(self.stack_events[::-1]):
# if ev[0] == StackEvent.POP:
# last_pop = index
# The list of stack events is split up into two kinds of "runs", runs of "push" events which don't have a corresponding "pop" yet
# And runs of push/pop events which are assumed to be balanced
# These latter can be straightforwardly accounted for by recursively removing the "outer" frame corresponding to a push/pop pair
# "push" events are trickier, because to get the allocations, they need to be compared to the *next* time hammer memory stats were sampled, be it push or pop
# TODO: perhaps a "pop" should act as a checkpoint, and commit every allocation up to that point
def calculate_and_clear_pushes_at_end(self):
# Throws StopIteration if no more items in the iterator match the condition
last_pop = next((index for index,ev in enumerate(self.stack_events[::-1]) if ev[0] == StackEvent.POP), None)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment