@@ -534,6 +534,7 @@ def main():
534534 sampling_group .add_argument (
535535 "--realtime-stats" ,
536536 action = "store_true" ,
537+ default = False ,
537538 help = "Print real-time sampling statistics (Hz, mean, min, max, stdev) during profiling" ,
538539 )
539540
@@ -628,27 +629,20 @@ def main():
628629 if args .format == "collapsed" :
629630 _validate_collapsed_format_args (args , parser )
630631
631- # Set sort value - use the specified sort or None if not specified
632- # The default sort=2 is handled by the sample function itself
633- sort_value = args .sort
634-
635- # Build the sample function call arguments
636- sample_kwargs = {
637- "sample_interval_usec" : args .interval ,
638- "duration_sec" : args .duration ,
639- "filename" : args .outfile ,
640- "all_threads" : args .all_threads ,
641- "limit" : args .limit ,
642- "sort" : sort_value ,
643- "show_summary" : not args .no_summary ,
644- "output_format" : args .format ,
645- }
646-
647- # Only add realtime_stats if it's explicitly set to True
648- if args .realtime_stats :
649- sample_kwargs ["realtime_stats" ] = args .realtime_stats
650-
651- sample (args .pid , ** sample_kwargs )
632+ sort_value = args .sort if args .sort is not None else 2
633+
634+ sample (
635+ args .pid ,
636+ sample_interval_usec = args .interval ,
637+ duration_sec = args .duration ,
638+ filename = args .outfile ,
639+ all_threads = args .all_threads ,
640+ limit = args .limit ,
641+ sort = sort_value ,
642+ show_summary = not args .no_summary ,
643+ output_format = args .format ,
644+ realtime_stats = args .realtime_stats ,
645+ )
652646
653647
654648if __name__ == "__main__" :
0 commit comments