@staticmethod<EOL><INDENT>def parse_perfmetric(metric):<DEDENT>
<EOL>perfcounters = re.findall(r'<STR_LIT>', metric)<EOL>temp_metric = metric<EOL>temp_pc_names = {"<STR_LIT>".format(re.sub("<STR_LIT>", "<STR_LIT:_>", pc)): pc<EOL>for i, pc in enumerate(perfcounters)}<EOL>for var_name, pc in temp_pc_names.items():<EOL><INDENT>temp_metric = temp_metric.replace(pc, var_name)<EOL><DEDENT>expr = parse_expr(temp_metric)<EOL>for s in expr.free_symbols:<EOL><INDENT>if s.name in temp_pc_names:<EOL><INDENT>s.name = temp_pc_names[str(s)]<EOL><DEDENT><DEDENT>events = {s: MachineModel.parse_perfctr_event(s.name) for s in expr.free_symbols<EOL>if s.name in perfcounters}<EOL>return expr, events<EOL>
Return (sympy expressions, event names and symbols dict) from performance metric str.