'Get node utilization from two sets of performance counters.'

def _get_node_utilization(self, counters_t1, counters_t2, node_name):

    try:
        kahuna_percent = self._get_kahuna_utilization(counters_t1, counters_t2)
        if (kahuna_percent > 60):
            return 100.0
        avg_cpu_percent = (100.0 * self._get_average_cpu_utilization(counters_t1, counters_t2))
        total_cp_time_msec = self._get_total_consistency_point_time(counters_t1, counters_t2)
        p2_flush_time_msec = self._get_consistency_point_p2_flush_time(counters_t1, counters_t2)
        poll_time_msec = self._get_total_time(counters_t1, counters_t2, 'total_cp_msecs')
        if ((total_cp_time_msec == 0) or (poll_time_msec == 0)):
            return max(min(100.0, avg_cpu_percent), 0)
        adjusted_cp_time_msec = self._get_adjusted_consistency_point_time(total_cp_time_msec, p2_flush_time_msec)
        adjusted_cp_percent = ((100.0 * adjusted_cp_time_msec) / poll_time_msec)
        node_utilization = max(avg_cpu_percent, adjusted_cp_percent)
        return max(min(100.0, node_utilization), 0)
    except Exception:
        LOG.exception('Could    not    calculate    node    utilization    for    node    %s.', node_name)
        return DEFAULT_UTILIZATION
