Skip to content

Commit 8b1b0b8

Browse files
author
miranov25
committed
fix(profiler): Save binary .prof files alongside .txt output
Technical fix to _run_with_profiling() to save both: - .txt: Human-readable stats (existing) - .prof: Binary profile for pstats/snakeviz analysis (was missing) Enables deeper analysis with: python -c "import pstats; pstats.Stats('file.prof').print_stats(30)" snakeviz file.prof
1 parent 643cc1f commit 8b1b0b8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

UTILS/dfextensions/AliasDataFrame/AliasDataFrame.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,8 +1725,15 @@ def _run_with_profiling(self, func, profile=False, profile_output=None):
17251725

17261726
if profile_output:
17271727
from pathlib import Path
1728+
# Save text output
17281729
Path(profile_output).write_text(output)
17291730
print(f"[profiler] Results saved to: {profile_output}")
1731+
1732+
# Also save binary .prof file for pstats/snakeviz analysis
1733+
prof_path = str(profile_output).replace('.txt', '.prof')
1734+
if prof_path != profile_output: # Only if extension was .txt
1735+
profiler.dump_stats(prof_path)
1736+
print(f"[profiler] Binary profile saved to: {prof_path}")
17301737
else:
17311738
print(output)
17321739

0 commit comments

Comments
 (0)