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

Function call_stats_section

Tools/scripts/summarize_stats.py:1100–1126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1098
1099
1100def call_stats_section() -> Section:
1101 def calc_call_stats_table(stats: Stats) -> Rows:
1102 call_stats = stats.get_call_stats()
1103 total = sum(v for k, v in call_stats.items() if "Calls to" in k)
1104 return [
1105 (key, Count(value), Ratio(value, total))
1106 for key, value in call_stats.items()
1107 ]
1108
1109 return Section(
1110 "Call stats",
1111 "Inlined calls and frame stats",
1112 [
1113 Table(
1114 ("", "Count:", "Ratio:"),
1115 calc_call_stats_table,
1116 JoinMode.CHANGE,
1117 )
1118 ],
1119 doc="""
1120 This shows what fraction of calls to Python functions are inlined (i.e.
1121 not having a call at the C level) and for those that are not, where the
1122 call comes from. The various categories overlap.
1123
1124 Also includes the count of frame objects created.
1125 """,
1126 )
1127
1128
1129def object_stats_section() -> Section:

Callers 1

summarize_stats.pyFile · 0.85

Calls 2

SectionClass · 0.70
TableClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…