def capture_and_print_timeshot(self, start_time, which,
                                   other=99, switch="x.x.x.x"):
        """Determine delta, keep track, and print results."""

        curr_timeout = time.time() - start_time
        if which in self.time_stats:
            self.time_stats[which]["total_time"] += curr_timeout
            self.time_stats[which]["total_count"] += 1
            if (curr_timeout < self.time_stats[which]["min"]):
                self.time_stats[which]["min"] = curr_timeout
            if (curr_timeout > self.time_stats[which]["max"]):
                self.time_stats[which]["max"] = curr_timeout
        else:
            self.time_stats[which] = {
                "total_time": curr_timeout,
                "total_count": 1,
                "min": curr_timeout,
                "max": curr_timeout}
        LOG.debug("NEXUS_TIME_STATS %(switch)s, pid %(pid)d, tid %(tid)d: "
                  "%(which)s_timeout %(curr)f count %(count)d "
                  "average %(ave)f other %(other)d min %(min)f max %(max)f",
                  {'switch': switch,
                  'pid': os.getpid(),
                  'tid': threading.current_thread().ident,
                  'which': which,
                  'curr': curr_timeout,
                  'count': self.time_stats[which]["total_count"],
                  'ave': (self.time_stats[which]["total_time"] /
                          self.time_stats[which]["total_count"]),
                  'other': other,
                  'min': self.time_stats[which]["min"],
                  'max': self.time_stats[which]["max"]})
def capture_and_print_timeshot ( self , start_time , which , other = 99 , switch = "x.x.x.x" ) : curr_timeout = time . time ( ) - start_time if which in self . time_stats : self . time_stats [ which ] [ "total_time" ] += curr_timeout self . time_stats [ which ] [ "total_count" ] += 1 if ( curr_timeout < self . time_stats [ which ] [ "min" ] ) : self . time_stats [ which ] [ "min" ] = curr_timeout if ( curr_timeout > self . time_stats [ which ] [ "max" ] ) : self . time_stats [ which ] [ "max" ] = curr_timeout else : self . time_stats [ which ] = { "total_time" : curr_timeout , "total_count" : 1 , "min" : curr_timeout , "max" : curr_timeout } LOG . debug ( "NEXUS_TIME_STATS %(switch)s, pid %(pid)d, tid %(tid)d: " "%(which)s_timeout %(curr)f count %(count)d " "average %(ave)f other %(other)d min %(min)f max %(max)f" , { 'switch' : switch , 'pid' : os . getpid ( ) , 'tid' : threading . current_thread ( ) . ident , 'which' : which , 'curr' : curr_timeout , 'count' : self . time_stats [ which ] [ "total_count" ] , 'ave' : ( self . time_stats [ which ] [ "total_time" ] / self . time_stats [ which ] [ "total_count" ] ) , 'other' : other , 'min' : self . time_stats [ which ] [ "min" ] , 'max' : self . time_stats [ which ] [ "max" ] } )
Determine delta, keep track, and print results.