@@ -102,7 +102,7 @@ def _parse_mode(mode_string):
102102def _check_process_died (process ):
103103 """Check if process died and raise an error with stderr if available."""
104104 if process .poll () is None :
105- return # Process still running
105+ return
106106
107107 # Process died - try to get stderr for error message
108108 stderr_msg = ""
@@ -471,7 +471,6 @@ def _handle_output(collector, args, pid, mode):
471471 sort_mode , limit , not args .no_summary , mode
472472 )
473473 else :
474- # Export to file
475474 filename = args .outfile or _generate_output_filename (args .format , pid )
476475 collector .export (filename )
477476
@@ -726,7 +725,6 @@ def _handle_attach(args):
726725 mode != PROFILING_MODE_WALL if mode != PROFILING_MODE_ALL else False
727726 )
728727
729- # For binary format, determine output file before creating collector
730728 output_file = None
731729 if args .format == "binary" :
732730 output_file = args .outfile or _generate_output_filename (args .format , args .pid )
@@ -806,7 +804,6 @@ def _handle_run(args):
806804 mode != PROFILING_MODE_WALL if mode != PROFILING_MODE_ALL else False
807805 )
808806
809- # For binary format, determine output file before creating collector
810807 output_file = None
811808 if args .format == "binary" :
812809 output_file = args .outfile or _generate_output_filename (args .format , process .pid )
@@ -940,7 +937,6 @@ def _handle_replay(args):
940937 """Handle the 'replay' command - convert binary profile to another format."""
941938 import os
942939
943- # Check input file exists
944940 if not os .path .exists (args .input_file ):
945941 sys .exit (f"Error: Input file not found: { args .input_file } " )
946942
@@ -956,10 +952,8 @@ def _handle_replay(args):
956952 print (f" Sample interval: { interval } us" )
957953 print (f" Compression: { 'zstd' if info .get ('compression_type' , 0 ) == 1 else 'none' } " )
958954
959- # Create appropriate collector
960955 collector = _create_collector (args .format , interval , skip_idle = False )
961956
962- # Replay with progress bar
963957 def progress_callback (current , total ):
964958 if total > 0 :
965959 pct = current / total
@@ -969,20 +963,17 @@ def progress_callback(current, total):
969963 print (f"\r [{ bar } ] { pct * 100 :5.1f} % ({ current :,} /{ total :,} )" , end = "" , flush = True )
970964
971965 count = reader .replay_samples (collector , progress_callback )
972- print () # Newline after progress bar
966+ print ()
973967
974- # Handle output similar to other formats
975968 if args .format == "pstats" :
976969 if args .outfile :
977970 collector .export (args .outfile )
978971 else :
979- # Print to stdout with defaults applied
980972 sort_choice = args .sort if args .sort is not None else "nsamples"
981973 limit = args .limit if args .limit is not None else 15
982974 sort_mode = _sort_to_mode (sort_choice )
983975 collector .print_stats (sort_mode , limit , not args .no_summary , PROFILING_MODE_WALL )
984976 else :
985- # Export to file
986977 filename = args .outfile or _generate_output_filename (args .format , os .getpid ())
987978 collector .export (filename )
988979
0 commit comments