@@ -467,7 +467,10 @@ def print_call_heading(self, name_size, column_title):
467467 subheader = isinstance (value , tuple )
468468 break
469469 if subheader :
470- print (" " * name_size + " ncalls tottime cumtime" , file = self .stream )
470+ self .print_call_subheading (name_size )
471+
472+ def print_call_subheading (self , name_size ):
473+ print (" " * name_size + " ncalls tottime cumtime" , file = self .stream )
471474
472475 def print_call_line (self , name_size , source , call_dict , arrow = "->" ):
473476 print (func_std_string (source ).ljust (name_size ) + arrow , end = ' ' , file = self .stream )
@@ -516,6 +519,35 @@ def print_line(self, func): # hack: should print percentages
516519 print (f8 (ct / cc ), end = ' ' , file = self .stream )
517520 print (func_std_string (func ), file = self .stream )
518521
522+
523+ class SampledStats (Stats ):
524+ def __init__ (self , * args , stream = None ):
525+ super ().__init__ (* args , stream = stream )
526+
527+ self .sort_arg_dict = {
528+ "samples" : (((1 ,- 1 ), ), "sample count" ),
529+ "nsamples" : (((1 ,- 1 ), ), "sample count" ),
530+ "cumtime" : (((3 ,- 1 ), ), "cumulative time" ),
531+ "cumulative" : (((3 ,- 1 ), ), "cumulative time" ),
532+ "filename" : (((4 , 1 ), ), "file name" ),
533+ "line" : (((5 , 1 ), ), "line number" ),
534+ "module" : (((4 , 1 ), ), "file name" ),
535+ "name" : (((6 , 1 ), ), "function name" ),
536+ "nfl" : (((6 , 1 ),(4 , 1 ),(5 , 1 ),), "name/file/line" ),
537+ "psamples" : (((0 ,- 1 ), ), "primitive call count" ),
538+ "stdname" : (((7 , 1 ), ), "standard name" ),
539+ "time" : (((2 ,- 1 ), ), "internal time" ),
540+ "tottime" : (((2 ,- 1 ), ), "internal time" ),
541+ }
542+
543+ def print_call_subheading (self , name_size ):
544+ print (" " * name_size + " nsamples tottime cumtime" , file = self .stream )
545+
546+ def print_title (self ):
547+ print (' nsamples tottime persample cumtime persample' , end = ' ' , file = self .stream )
548+ print ('filename:lineno(function)' , file = self .stream )
549+
550+
519551class TupleComp :
520552 """This class provides a generic function for comparing any two tuples.
521553 Each instance records a list of tuple-indices (from most significant
0 commit comments