def calcCpuUsage(counters1, counters2):
    """
    Calculate system CPU usage
    :param counters1: dict, output of readCpuInfo()
    :param counters2: dict, output of readCpuInfo()
    :return: system CPU usage
    """
    idle = counters2['idle'] - counters1['idle']
    total = counters2['total'] - counters1['total']
    # return 100 - (idle*100/total)
    return 1 - (idle / total)