def METHOD_NAME(self):
    while(self.gui.client == None):
        pass
    previous_time = datetime.now()
    while(True):
        # Sleep for 2 seconds
        time.sleep(2)
        # Measure the current time and subtract from previous time to get real time interval
        current_time = datetime.now()
        dt = current_time - previous_time
        ms = (dt.days * 24 * 60 * 60 + dt.seconds) * 1000 + dt.microseconds / 1000.0
        previous_time = current_time
        # Get the time period
        try:
            # Division by zero
            self.measured_cycle = ms / self.iteration_counter
        except:
            self.measured_cycle = 0
        # Reset the counter
        self.iteration_counter = 0