#NEWLINE# def _RotateCounts( self , throttle_name ) : #NEWLINE# #INDENT# 'Rotate the transfer counters.\n\n    If sufficient time has passed, then rotate the counters from active to\n    the prior-block of counts.\n\n    This rotation is interlocked to ensure that multiple threads do not\n    over-rotate the counts.\n\n    Args:\n      throttle_name: The name of the throttle to rotate.\n    ' #NEWLINE# self . VerifyThrottleName ( throttle_name ) #NEWLINE# self . rotate_mutex [ throttle_name ] . acquire ( ) #NEWLINE# try : #NEWLINE# #INDENT# next_rotate_time = ( self . last_rotate [ throttle_name ] + self . ROTATE_PERIOD ) #NEWLINE# if ( count >= self . get_time ( ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for ( name , count ) in self . transferred [ throttle_name ] . items ( ) : #NEWLINE# #INDENT# self . prior_block [ throttle_name ] [ name ] = count #NEWLINE# self . transferred [ throttle_name ] [ name ] = 0 #NEWLINE# self . totals [ throttle_name ] [ name ] += count #NEWLINE# #UNINDENT# self . last_rotate [ throttle_name ] = self . get_time ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . rotate_mutex [ throttle_name ] . release ( )