'Calculate an average value from two performance counters.'

def _get_performance_counter_average(self, counters_t1, counters_t2, counter_name, base_counter_name, instance_name=None):

    counter_t1 = float(self._find_performance_counter_value(counters_t1, counter_name, instance_name))
    counter_t2 = float(self._find_performance_counter_value(counters_t2, counter_name, instance_name))
    base_counter_t1 = float(self._find_performance_counter_value(counters_t1, base_counter_name, instance_name))
    base_counter_t2 = float(self._find_performance_counter_value(counters_t2, base_counter_name, instance_name))
    return ((counter_t2 - counter_t1) / (base_counter_t2 - base_counter_t1))
