MCPcopy Index your code
hub / github.com/python/cpython / calc

Function calc

Tools/scripts/summarize_stats.py:746–769  ·  view source on GitHub ↗
(stats: Stats)

Source from the content-addressed store, hash-verified

744
745def calc_execution_count_table(prefix: str) -> RowCalculator:
746 def calc(stats: Stats) -> Rows:
747 opcode_stats = stats.get_opcode_stats(prefix)
748 counts = opcode_stats.get_execution_counts()
749 total = opcode_stats.get_total_execution_count()
750 cumulative = 0
751 rows: Rows = []
752 for opcode, (count, miss) in sorted(
753 counts.items(), key=itemgetter(1), reverse=True
754 ):
755 cumulative += count
756 if miss:
757 miss_val = Ratio(miss, count)
758 else:
759 miss_val = None
760 rows.append(
761 (
762 opcode,
763 Count(count),
764 Ratio(count, total),
765 Ratio(cumulative, total),
766 miss_val,
767 )
768 )
769 return rows
770
771 return calc
772

Callers

nothing calls this directly

Calls 15

itemgetterClass · 0.90
CountClass · 0.85
get_opcode_statsMethod · 0.80
get_execution_countsMethod · 0.80
get_histogramMethod · 0.80
RatioClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…