示例#1
0
def compute_metric(current_dir, rampup_value, metric, metric_name):
    array = numpy.array(metric)
    mean_group = numpy.mean(metric)
    deviance_percentage = compute_deviance_percentage(metric)
    deviance = numpy.std(array)
    utils.write_gnuplot_file(current_dir + "/%s-mean.plot" % metric_name, rampup_value, mean_group)
    utils.write_gnuplot_file(
        current_dir + "/%s-deviance_percentage.plot" % metric_name, rampup_value, deviance_percentage
    )
    utils.write_gnuplot_file(current_dir + "/%s-deviance.plot" % metric_name, rampup_value, deviance)
示例#2
0
def compute_metric(current_dir, rampup_value, metric, metric_name):
    array = numpy.array(metric)
    mean_group = numpy.mean(metric)
    deviance_percentage = compute_deviance_percentage(metric)
    deviance = numpy.std(array)
    utils.write_gnuplot_file(current_dir + "/%s-mean.plot" % metric_name,
                             rampup_value, mean_group)
    utils.write_gnuplot_file(
        current_dir + "/%s-deviance_percentage.plot" % metric_name,
        rampup_value, deviance_percentage)
    utils.write_gnuplot_file(current_dir + "/%s-deviance.plot" % metric_name,
                             rampup_value, deviance)
示例#3
0
def print_perf(tolerance_min, tolerance_max, item, df, mode, title,
               consistent=None, curious=None, unstable=None,
               sub_graph="", rampup_value=0, current_dir=""):
    # Tolerance_min represents the min where variance
    # shall be considered (in %)
    # Tolerance_max represents the maximum that variance
    # represent regarding the average (in %)

    variance_group = item.std()
    mean_group = item.mean()
    sum_group = item.sum()
    min_group = mean_group - 2 * variance_group
    max_group = mean_group + 2 * variance_group

    utils.do_print(mode, utils.Levels.INFO,
                   "%-12s : Group performance : min=%8.2f, mean=%8.2f, "
                   "max=%8.2f, stddev=%8.2f", title, item.min(),
                   mean_group, item.max(), variance_group)

    variance_tolerance = compute_deviance_percentage(title, df.transpose())

    if (rampup_value > 0) and (current_dir):
        utils.write_gnuplot_file(current_dir + "/deviance.plot",
                                 rampup_value, variance_group)
        utils.write_gnuplot_file(current_dir + "/deviance_percentage.plot",
                                 rampup_value, variance_tolerance)
        utils.write_gnuplot_file(current_dir + "/mean%s.plot" % sub_graph,
                                 rampup_value, mean_group)
        utils.write_gnuplot_file(current_dir + "/sum%s.plot" % sub_graph,
                                 rampup_value, sum_group)

    if variance_tolerance > tolerance_max:
        utils.do_print(mode, utils.Levels.ERROR,
                       "%-12s : Group's variance is too important : %7.2f%% "
                       "of %7.2f whereas limit is set to %3.2f%%", title,
                       variance_tolerance, mean_group, tolerance_max)
        utils.do_print(mode, utils.Levels.ERROR,
                       "%-12s : Group performance : UNSTABLE", title)
        for host in df.columns:
            if host not in curious:
                unstable.append(host)
    else:
        curious_performance = False
        for host in df.columns:
            if (("loops_per_sec") in mode) or ("bogomips" in mode):
                mean_host = df[host][title].mean()
            else:
                mean_host = df[host].mean()
            # If the variance is very low, don't try to find the black sheep
            if variance_tolerance > tolerance_min:
                if mean_host > max_group:
                    curious_performance = True
                    utils.do_print(
                        mode, utils.Levels.WARNING,
                        "%-12s : %s : Curious overperformance  %7.2f : "
                        "min_allow_group = %.2f, mean_group = %.2f "
                        "max_allow_group = %.2f", title, host, mean_host,
                        min_group, mean_group, max_group)
                    if host not in curious:
                        curious.append(host)
                        if host in consistent:
                            consistent.remove(host)
                elif mean_host < min_group:
                    curious_performance = True
                    utils.do_print(
                        mode, utils.Levels.WARNING,
                        "%-12s : %s : Curious underperformance %7.2f : "
                        "min_allow_group = %.2f, mean_group = %.2f "
                        "max_allow_group = %.2f", title, host, mean_host,
                        min_group, mean_group, max_group)
                    if host not in curious:
                        curious.append(host)
                        if host in consistent:
                            consistent.remove(host)
                else:
                    if (host not in consistent) and (host not in curious):
                        consistent.append(host)
            else:
                if (host not in consistent) and (host not in curious):
                    consistent.append(host)

        unit = " "
        if "Effi." in title:
            unit = "%"
        if curious_performance is False:
            utils.do_print(
                mode, utils.Levels.INFO,
                "%-12s : Group performance = %7.2f %s : CONSISTENT",
                title, mean_group, unit)
        else:
            utils.do_print(mode, utils.Levels.WARNING,
                           "%-12s : Group performance = %7.2f %s : SUSPICIOUS",
                           title, mean_group, unit)
示例#4
0
文件: check.py 项目: whouses/hardware
def print_perf(tolerance_min, tolerance_max, item, df, mode, title,
               consistent=None, curious=None, unstable=None,
               sub_graph="", rampup_value=0, current_dir=""):
    # Tolerance_min represents the min where variance
    # shall be considered (in %)
    # Tolerance_max represents the maximum that variance
    # represent regarding the average (in %)

    variance_group = item.std()
    mean_group = item.mean()
    sum_group = item.sum()
    min_group = mean_group - 2 * variance_group
    max_group = mean_group + 2 * variance_group

    utils.do_print(mode, utils.Levels.INFO,
                   "%-12s : Group performance : min=%8.2f, mean=%8.2f, "
                   "max=%8.2f, stddev=%8.2f", title, item.min(),
                   mean_group, item.max(), variance_group)

    variance_tolerance = compute_deviance_percentage(title, df.transpose())

    if (rampup_value > 0) and (current_dir):
        utils.write_gnuplot_file(current_dir + "/deviance.plot",
                                 rampup_value, variance_group)
        utils.write_gnuplot_file(current_dir + "/deviance_percentage.plot",
                                 rampup_value, variance_tolerance)
        utils.write_gnuplot_file(current_dir + "/mean%s.plot"% sub_graph, rampup_value,
                                 mean_group)
        utils.write_gnuplot_file(current_dir + "/sum%s.plot" % sub_graph, rampup_value,
                                 sum_group)

    if variance_tolerance > tolerance_max:
        utils.do_print(mode, utils.Levels.ERROR,
                       "%-12s : Group's variance is too important : %7.2f%% "
                       "of %7.2f whereas limit is set to %3.2f%%", title,
                       variance_tolerance, mean_group, tolerance_max)
        utils.do_print(mode, utils.Levels.ERROR,
                       "%-12s : Group performance : UNSTABLE", title)
        for host in df.columns:
            if host not in curious:
                unstable.append(host)
    else:
        curious_performance = False
        for host in df.columns:
            if (("loops_per_sec") in mode) or ("bogomips" in mode):
                mean_host = df[host][title].mean()
            else:
                mean_host = df[host].mean()
            # If the variance is very low, don't try to find the black sheep
            if variance_tolerance > tolerance_min:
                if mean_host > max_group:
                    curious_performance = True
                    utils.do_print(
                        mode, utils.Levels.WARNING,
                        "%-12s : %s : Curious overperformance  %7.2f : "
                        "min_allow_group = %.2f, mean_group = %.2f "
                        "max_allow_group = %.2f", title, host, mean_host,
                        min_group, mean_group, max_group)
                    if host not in curious:
                        curious.append(host)
                        if host in consistent:
                            consistent.remove(host)
                elif mean_host < min_group:
                    curious_performance = True
                    utils.do_print(
                        mode, utils.Levels.WARNING,
                        "%-12s : %s : Curious underperformance %7.2f : "
                        "min_allow_group = %.2f, mean_group = %.2f "
                        "max_allow_group = %.2f", title, host, mean_host,
                        min_group, mean_group, max_group)
                    if host not in curious:
                        curious.append(host)
                        if host in consistent:
                            consistent.remove(host)
                else:
                    if (host not in consistent) and (host not in curious):
                        consistent.append(host)
            else:
                if (host not in consistent) and (host not in curious):
                    consistent.append(host)

        unit = " "
        if "Effi." in title:
            unit = "%"
        if curious_performance is False:
            utils.do_print(
                mode, utils.Levels.INFO,
                "%-12s : Group performance = %7.2f %s : CONSISTENT",
                title, mean_group, unit)
        else:
            utils.do_print(mode, utils.Levels.WARNING,
                           "%-12s : Group performance = %7.2f %s : SUSPICIOUS",
                           title, mean_group, unit)