def remove_irrelevant_nodes(frame, options, total_time=None):
if frame is None:<EOL><INDENT>return None<EOL><DEDENT>if total_time is None:<EOL><INDENT>total_time = frame.time()<EOL><DEDENT>filter_threshold = options.get('<STR_LIT>', <NUM_LIT>)<EOL>for child in frame.children:<EOL><INDENT>proportion_of_total = child.time() / total_time<EOL>if proportion_of_total < filter_threshold:<EOL><INDENT>frame.self_time += child.time()<EOL>child.remove_from_parent()<EOL><DEDENT><DEDENT>for child in frame.children:<EOL><INDENT>remove_irrelevant_nodes(child, options=options, total_time=total_time)<EOL><DEDENT>return frame<EOL>
Remove nodes that represent less than e.g. 1% of the output