diff --git a/gdb-port/parser.py b/gdb-port/parser.py index c7f40436643e5ca4ccc3eeb7e55cf15e6781f739..b1215e4cc783a1618b384541f2ae04671a3d8f22 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -4,9 +4,9 @@ class Parser: self.address = address self.bytes_used = {} self.bytes_used_from_hammer_stats = {} # TODO: once breakpoints vs detailed are exclusive, this should be removed - self.apply_count = 0 - self.successful_parse_count = 0 - self.failed_parse_count = 0 + self.apply_count = {} # Per arena + self.successful_parse_count = {} + self.failed_parse_count = {} def name_parser(self, name): self.name = name @@ -49,23 +49,29 @@ class Parser: res = sum(self.bytes_used.values()) return res - def increment_apply_count(self): - self.apply_count += 1 + def increment_apply_count(self, arena): + applycount = self.apply_count.get(arena, 0) + applycount += 1 + self.apply_count.set(arena, applycount) - def get_apply_count(self): - return self.apply_count + def get_apply_count(self, arena): + return self.apply_count.get(arena, 0) - def increment_successful_parse_count(self): - self.successful_parse_count += 1 + def increment_successful_parse_count(self, arena): + s_count = self.successful_parse_count.get(arena, 0) + s_count += 1 + self.successful_parse_count_count.set(arena, s_count) - def get_successful_parse_count(self): - return self.successful_parse_count + def get_successful_parse_count(self, arena): + return self.successful_parse_count.get(arena, 0) - def increment_failed_parse_count(self): - self.failed_parse_count += 1 + def increment_failed_parse_count(self, arena): + f_count = self.failed_parse_count.get(arena, 0) + f_count += 1 + self.failed_parse_count_count.set(arena, f_count) - def get_failed_parse_count(self): - return self.failed_parse_count + def get_failed_parse_count(self, arena): + return self.failed_parse_count.get(arena, 0) class ParserStack: def __init__(self, parse_state, arena): diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index 077731c17fbddd0e733cd7511ba65ca3ac03dbbe..1976dfd6b064049c01751fc67d18af367725fb39 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -74,7 +74,7 @@ class TopLevelParse: parser_obj = Parser(None, parser) self.parser_objs[parser] = parser_obj self.h_do_parse_parser = parser_obj # TODO: current_parser_env should be set here instead too - parser_obj.increment_apply_count() + parser_obj.increment_apply_count(int(arena)) if parser_stack.parse_state is None and parser_stack.parse_state != parse_state: self.first_h_do_parse_after_packrat_parse(parse_state, arena) @@ -86,9 +86,9 @@ class TopLevelParse: # If other backends are supported, this might change to pushing/popping the stack in h_do_parse() self.h_do_parse_parser = parser_obj # Restore the "current" parser, otherwise it'll show the parser h_do_parse() was last called with on the GUI and backtrace if ret_val: - parser_obj.increment_successful_parse_count() + parser_obj.increment_successful_parse_count(int(parse_state['arena'])) else: - parser_obj.increment_failed_parse_count() + parser_obj.increment_failed_parse_count(int(parse_state['arena'])) if self.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS: #if self.extended_arena_stats_available(): # DEBUG