@@ -137,20 +137,20 @@ def __init__(
137137 self ._saved_stderr = None
138138 self ._devnull = None
139139 self ._last_display_update = None
140- self ._max_sample_rate = 0 # Track maximum sample rate seen
141- self ._successful_samples = 0 # Track samples that captured frames
142- self ._failed_samples = 0 # Track samples that failed to capture frames
143- self ._display_update_interval = DISPLAY_UPDATE_INTERVAL # Instance variable for display refresh rate
140+ self .max_sample_rate = 0 # Track maximum sample rate seen
141+ self .successful_samples = 0 # Track samples that captured frames
142+ self .failed_samples = 0 # Track samples that failed to capture frames
143+ self .display_update_interval = DISPLAY_UPDATE_INTERVAL # Instance variable for display refresh rate
144144
145145 # Thread status statistics (bit flags)
146- self ._thread_status_counts = {
146+ self .thread_status_counts = {
147147 "has_gil" : 0 ,
148148 "on_cpu" : 0 ,
149149 "gil_requested" : 0 ,
150150 "unknown" : 0 ,
151151 "total" : 0 , # Total thread count across all samples
152152 }
153- self ._gc_frame_samples = 0 # Track samples with GC frames
153+ self .gc_frame_samples = 0 # Track samples with GC frames
154154
155155 # Interactive controls state
156156 self .paused = False # Pause UI updates (profiling continues)
@@ -174,10 +174,10 @@ def __init__(
174174 self ._path_prefixes = self ._get_common_path_prefixes ()
175175
176176 # Widgets (initialized when display is available)
177- self ._header_widget = None
178- self ._table_widget = None
179- self ._footer_widget = None
180- self ._help_widget = None
177+ self .header_widget = None
178+ self .table_widget = None
179+ self .footer_widget = None
180+ self .help_widget = None
181181
182182 # Color mode
183183 self ._can_colorize = _colorize .can_colorize ()
@@ -256,7 +256,7 @@ def _get_common_path_prefixes(self):
256256
257257 return prefixes
258258
259- def _simplify_path (self , filepath ):
259+ def simplify_path (self , filepath ):
260260 """Simplify a file path by removing common prefixes."""
261261 # Try to match against known prefixes
262262 for prefix_path in self ._path_prefixes :
@@ -268,7 +268,7 @@ def _simplify_path(self, filepath):
268268 # If no match, return the original path
269269 return filepath
270270
271- def _process_frames (self , frames , thread_id = None ):
271+ def process_frames (self , frames , thread_id = None ):
272272 """Process a single thread's frame stack.
273273
274274 Args:
@@ -295,7 +295,7 @@ def _process_frames(self, frames, thread_id=None):
295295 thread_data .result [top_location ]["direct_calls" ] += 1
296296
297297 def collect_failed_sample (self ):
298- self ._failed_samples += 1
298+ self .failed_samples += 1
299299 self .total_samples += 1
300300
301301 def collect (self , stack_frames ):
@@ -349,7 +349,7 @@ def collect(self, stack_frames):
349349
350350 frames = getattr (thread_info , "frame_info" , None )
351351 if frames :
352- self ._process_frames (frames , thread_id = thread_id )
352+ self .process_frames (frames , thread_id = thread_id )
353353
354354 # Track thread IDs only for threads that actually have samples
355355 if (
@@ -375,12 +375,12 @@ def collect(self, stack_frames):
375375
376376 # Update cumulative thread status counts
377377 for key , count in temp_status_counts .items ():
378- self ._thread_status_counts [key ] += count
378+ self .thread_status_counts [key ] += count
379379
380380 if has_gc_frame :
381- self ._gc_frame_samples += 1
381+ self .gc_frame_samples += 1
382382
383- self ._successful_samples += 1
383+ self .successful_samples += 1
384384 self .total_samples += 1
385385
386386 # Handle input on every sample for instant responsiveness
@@ -393,15 +393,15 @@ def collect(self, stack_frames):
393393 if (
394394 self ._last_display_update is None
395395 or (current_time - self ._last_display_update )
396- >= self ._display_update_interval
396+ >= self .display_update_interval
397397 ):
398398 self ._update_display ()
399399 self ._last_display_update = current_time
400400
401401 def _prepare_display_data (self , height ):
402402 """Prepare data for display rendering."""
403403 elapsed = self .elapsed_time
404- stats_list = self ._build_stats_list ()
404+ stats_list = self .build_stats_list ()
405405
406406 # Calculate available space for stats
407407 # Add extra lines for finished banner when in finished state
@@ -422,15 +422,15 @@ def _prepare_display_data(self, height):
422422
423423 def _initialize_widgets (self , colors ):
424424 """Initialize widgets with display and colors."""
425- if self ._header_widget is None :
425+ if self .header_widget is None :
426426 # Initialize trend tracker with colors
427427 if self ._trend_tracker is None :
428428 self ._trend_tracker = TrendTracker (colors , enabled = True )
429429
430- self ._header_widget = HeaderWidget (self .display , colors , self )
431- self ._table_widget = TableWidget (self .display , colors , self )
432- self ._footer_widget = FooterWidget (self .display , colors , self )
433- self ._help_widget = HelpWidget (self .display , colors )
430+ self .header_widget = HeaderWidget (self .display , colors , self )
431+ self .table_widget = TableWidget (self .display , colors , self )
432+ self .footer_widget = FooterWidget (self .display , colors , self )
433+ self .help_widget = HelpWidget (self .display , colors )
434434
435435 def _render_display_sections (
436436 self , height , width , elapsed , stats_list , colors
@@ -442,12 +442,12 @@ def _render_display_sections(
442442 self ._initialize_widgets (colors )
443443
444444 # Render header
445- line = self ._header_widget .render (
445+ line = self .header_widget .render (
446446 line , width , elapsed = elapsed , stats_list = stats_list
447447 )
448448
449449 # Render table
450- line = self ._table_widget .render (
450+ line = self .table_widget .render (
451451 line , width , height = height , stats_list = stats_list
452452 )
453453
@@ -473,7 +473,7 @@ def _update_display(self):
473473
474474 # Show help screen if requested
475475 if self .show_help :
476- self ._help_widget .render (0 , width , height = height )
476+ self .help_widget .render (0 , width , height = height )
477477 self .display .refresh ()
478478 return
479479
@@ -486,11 +486,11 @@ def _update_display(self):
486486 )
487487
488488 # Footer
489- self ._footer_widget .render (height - 2 , width )
489+ self .footer_widget .render (height - 2 , width )
490490
491491 # Show filter input prompt if in filter input mode
492492 if self .filter_input_mode :
493- self ._footer_widget .render_filter_input_prompt (
493+ self .footer_widget .render_filter_input_prompt (
494494 height - 1 , width
495495 )
496496
@@ -616,7 +616,7 @@ def _setup_colors(self):
616616 "trend_stable" : A_NORMAL ,
617617 }
618618
619- def _build_stats_list (self ):
619+ def build_stats_list (self ):
620620 """Build and sort the statistics list."""
621621 stats_list = []
622622 result_source = self ._get_current_result_source ()
@@ -707,17 +707,17 @@ def reset_stats(self):
707707 self .view_mode = "ALL"
708708 self .current_thread_index = 0
709709 self .total_samples = 0
710- self ._successful_samples = 0
711- self ._failed_samples = 0
712- self ._max_sample_rate = 0
713- self ._thread_status_counts = {
710+ self .successful_samples = 0
711+ self .failed_samples = 0
712+ self .max_sample_rate = 0
713+ self .thread_status_counts = {
714714 "has_gil" : 0 ,
715715 "on_cpu" : 0 ,
716716 "gil_requested" : 0 ,
717717 "unknown" : 0 ,
718718 "total" : 0 ,
719719 }
720- self ._gc_frame_samples = 0
720+ self .gc_frame_samples = 0
721721 # Clear trend tracking
722722 if self ._trend_tracker is not None :
723723 self ._trend_tracker .clear ()
@@ -886,14 +886,14 @@ def _handle_input(self):
886886
887887 elif ch == ord ("+" ) or ch == ord ("=" ):
888888 # Decrease update interval (faster refresh)
889- self ._display_update_interval = max (
890- 0.05 , self ._display_update_interval - 0.05
889+ self .display_update_interval = max (
890+ 0.05 , self .display_update_interval - 0.05
891891 ) # Min 20Hz
892892
893893 elif ch == ord ("-" ) or ch == ord ("_" ):
894894 # Increase update interval (slower refresh)
895- self ._display_update_interval = min (
896- 1.0 , self ._display_update_interval + 0.05
895+ self .display_update_interval = min (
896+ 1.0 , self .display_update_interval + 0.05
897897 ) # Max 1Hz
898898
899899 elif ch == ord ("c" ) or ch == ord ("C" ):
0 commit comments