Ejemplo n.º 1
0
def print_summary(mode, array, array_name, unit, df, item_value=None):
    if (utils.PRINTLEVEL & utils.Levels.SUMMARY) and array:
        result = []
        before = ""
        after = ""
        RED = "\033[1;31m"
        ORANGE = "\033[1;33m"
        WHITE = "\033[1;m"
        GREEN = "\033[1;32m"

        for host in array:
            result.append(df[host].sum())
        if "unstable" in array_name:
            before = RED
            after = WHITE
        if "curious" in array_name:
            before = ORANGE
            after = WHITE

        mean = numpy.mean(result)
        perf_status = ""
        if array_name == "consistent":
            if item_value is not None:
                if mode in ("loops_per_sec", "bogomips"):
                    min_cpu_perf = perf_cpu_tables.get_cpu_min_perf(mode,
                                                                    item_value)
                    if min_cpu_perf == 0:
                        perf_status = (": %(orange)sNO PERF ENTRY IN DB"
                                       "%(white)s for %(item_value)s" %
                                       {'orange': ORANGE,
                                        'white': WHITE,
                                        'item_value': item_value})
                    elif mean >= min_cpu_perf:
                        perf_status = (": %(green)sPERF OK%(white)s" %
                                       {'green': GREEN,
                                        'white': WHITE})
                    else:
                        perf_status = (": %(red)sPERF FAIL%(white)s as min "
                                       "perf should have been : "
                                       "%(min_cpu_perf)s" %
                                       {'red': RED,
                                        'white': WHITE,
                                        'min_cpu_perf': str(min_cpu_perf)})

        msg = ("%(array_length)3d %(before)s%(array_name)-10s%(after)s hosts "
               "with %(mean)8.2f %(unit)-4s as average value and "
               "%(result)8.2f standard deviation %(perf_status)s" %
               {'array_length': len(array),
                'before': before,
                'array_name': array_name,
                'after': after,
                'mean': mean,
                'unit': unit,
                'result': numpy.std(result),
                'perf_status': perf_status})

        utils.do_print(mode, utils.Levels.SUMMARY, msg)
Ejemplo n.º 2
0
def print_summary(mode, array, array_name, unit, df, item_value=None):
    if (utils.print_level & utils.Levels.SUMMARY) and (len(array) > 0):
        result = []
        before = ""
        after = ""
        RED = "\033[1;31m"
        ORANGE = "\033[1;33m"
        WHITE = "\033[1;m"
        GREEN = "\033[1;32m"

        for host in array:
            result.append(df[host].sum())
        if "unstable" in array_name:
            before = RED
            after = WHITE
        if "curious" in array_name:
            before = ORANGE
            after = WHITE

        mean = numpy.mean(result)
        perf_status = ""
        if array_name == "consistent":
            if item_value is not None:
                if mode == "loops_per_sec" or mode == "bogomips":
                    min_cpu_perf = perf_cpu_tables.get_cpu_min_perf(mode,
                                                                    item_value)
                    if min_cpu_perf == 0:
                        perf_status = (": " + ORANGE + "NO PERF ENTRY IN DB" +
                                       WHITE + " for " + item_value)
                    elif mean >= min_cpu_perf:
                        perf_status = ": " + GREEN + "PERF OK" + WHITE
                    else:
                        perf_status = (": " + RED + "PERF FAIL" + WHITE +
                                       " as min perf should have been : " +
                                       str(min_cpu_perf))
        utils.do_print(
            mode, utils.Levels.SUMMARY,
            "%3d %s%-10s%s hosts with %8.2f %-4s as average value and %8.2f "
            "standard deviation %s", len(array), before, array_name, after,
            mean, unit, numpy.std(result), perf_status)
Ejemplo n.º 3
0
def print_summary(mode, array, array_name, unit, df, item_value=None):
    if (utils.PRINTLEVEL & utils.Levels.SUMMARY) and array:
        result = []
        before = ""
        after = ""
        RED = "\033[1;31m"
        ORANGE = "\033[1;33m"
        WHITE = "\033[1;m"
        GREEN = "\033[1;32m"

        for host in array:
            result.append(df[host].sum())
        if "unstable" in array_name:
            before = RED
            after = WHITE
        if "curious" in array_name:
            before = ORANGE
            after = WHITE

        mean = numpy.mean(result)
        perf_status = ""
        if array_name == "consistent":
            if item_value is not None:
                if mode in ("loops_per_sec", "bogomips"):
                    min_cpu_perf = perf_cpu_tables.get_cpu_min_perf(
                        mode, item_value)
                    if min_cpu_perf == 0:
                        perf_status = (": " + ORANGE + "NO PERF ENTRY IN DB" +
                                       WHITE + " for " + item_value)
                    elif mean >= min_cpu_perf:
                        perf_status = ": " + GREEN + "PERF OK" + WHITE
                    else:
                        perf_status = (": " + RED + "PERF FAIL" + WHITE +
                                       " as min perf should have been : " +
                                       str(min_cpu_perf))
        utils.do_print(
            mode, utils.Levels.SUMMARY,
            "%3d %s%-10s%s hosts with %8.2f %-4s as average value and %8.2f "
            "standard deviation %s", len(array), before, array_name, after,
            mean, unit, numpy.std(result), perf_status)
Ejemplo n.º 4
0
 def test_cpu4(self):
     cpu_type = "Intel(R) Leon(R) CPU E7-2750 0 @ 2.20GHz"
     cpu_perf = perf_cpu_tables.get_cpu_min_perf("loops_per_sec", cpu_type)
     self.assertEqual(cpu_perf, 0)
Ejemplo n.º 5
0
 def test_cpu1(self):
     cpu_type = "Intel(R) Xeon(R) CPU E5-2650 0 @ 2.20GHz"
     cpu_perf = perf_cpu_tables.get_cpu_min_perf("loops_per_sec", cpu_type)
     self.assertEqual(cpu_perf, 420)
 def test_cpu4(self):
     cpu_type = "Intel(R) Leon(R) CPU E7-2750 0 @ 2.20GHz"
     cpu_perf = perf_cpu_tables.get_cpu_min_perf("loops_per_sec", cpu_type)
     self.assertEqual(cpu_perf, 0)
 def test_cpu1(self):
     cpu_type = "Intel(R) Xeon(R) CPU E5-2650 0 @ 2.20GHz"
     cpu_perf = perf_cpu_tables.get_cpu_min_perf("loops_per_sec", cpu_type)
     self.assertEqual(cpu_perf, 420)