Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
296 changes: 198 additions & 98 deletions InternalDocs/profiling_binary_format.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Lib/profiling/sampling/binary_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def get_stats(self):
"""Get encoding statistics.

Returns:
Dict with encoding statistics including repeat/full/suffix/pop-push
Dict with encoding statistics including repeat/full/suffix/reuse
record counts, frames written/saved, and compression ratio.
"""
return self._writer.get_stats()
Expand Down
8 changes: 4 additions & 4 deletions Lib/profiling/sampling/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,22 @@ def _print_binary_stats(self, collector):
repeat_samples = stats.get('repeat_samples', 0)
full_records = stats.get('full_records', 0)
suffix_records = stats.get('suffix_records', 0)
pop_push_records = stats.get('pop_push_records', 0)
reuse_records = stats.get('reuse_records', 0)
total_records = stats.get('total_records', 0)

if total_records > 0:
repeat_pct = repeat_records / total_records * 100
full_pct = full_records / total_records * 100
suffix_pct = suffix_records / total_records * 100
pop_push_pct = pop_push_records / total_records * 100
reuse_pct = reuse_records / total_records * 100
else:
repeat_pct = full_pct = suffix_pct = pop_push_pct = 0
repeat_pct = full_pct = suffix_pct = reuse_pct = 0

print(f" Records: {total_records:,}")
print(f" RLE repeat: {repeat_records:,} ({ANSIColors.GREEN}{repeat_pct:.1f}%{ANSIColors.RESET}) [{repeat_samples:,} samples]")
print(f" Full stack: {full_records:,} ({full_pct:.1f}%)")
print(f" Suffix match: {suffix_records:,} ({suffix_pct:.1f}%)")
print(f" Pop-push: {pop_push_records:,} ({pop_push_pct:.1f}%)")
print(f" Stack reuse: {reuse_records:,} ({reuse_pct:.1f}%)")

frames_written = stats.get('total_frames_written', 0)
frames_saved = stats.get('frames_saved', 0)
Expand Down
Loading
Loading