#NEWLINE# def capture_and_print_timeshot( self , start_time , which , other = 99 , switch = '0.0.0.0' ) : #NEWLINE# #INDENT# 'Determine delta, keep track, and print results.' #NEWLINE# curr_timeout = ( time . time ( ) - start_time ) #NEWLINE# if ( which in self . time_stats ) : #NEWLINE# #INDENT# self . time_stats [ which ] [ 'total_time' ] += curr_timeout #NEWLINE# self . time_stats [ which ] [ 'total_count' ] += 1 #NEWLINE# if ( curr_timeout < self . time_stats [ which ] [ 'min' ] ) : #NEWLINE# #INDENT# self . time_stats [ which ] [ 'min' ] = curr_timeout #NEWLINE# #UNINDENT# if ( curr_timeout > self . time_stats [ which ] [ 'max' ] ) : #NEWLINE# #INDENT# self . time_stats [ which ] [ 'max' ] = curr_timeout #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . time_stats [ which ] = { #NEWLINE# #INDENT# 'total_time' : curr_timeout , #NEWLINE# 'total_count' : 1 , #NEWLINE# 'min' : curr_timeout , #NEWLINE# 'max' : curr_timeout , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# LOG . debug ( 'NEXUS_TIME_STATS %s: %s_timeout %f count %d average %f other %d min %f max %f' , switch , self , curr_timeout , self . time_stats [ which ] [ 'total_count' ] , ( self . time_stats [ which ] [ 'total_time' ] / self . time_stats [ which ] [ 'total_count' ] ) , other , self . time_stats [ which ] [ 'min' ] , self . time_stats [ which ] [ 'max' ] )