Example #1
0
def create_suite(name, node, data_path):
    """
    Creates a suite suitable for adding to a perfherder blob. Calculates the
    geometric mean of the checkpoint values and adds that to the suite as
    well.

    :param name: The name of the suite.
    :param node: The path of the data node to extract data from.
    :param data_path: The directory to retrieve data from.
    """
    suite = {
        'name': name,
        'subtests': [],
        'lowerIsBetter': True,
        'units': 'bytes'
    }
    if 'STYLO_FORCE_ENABLED' in os.environ and os.environ[
            'STYLO_FORCE_ENABLED']:
        suite['extraOptions'] = ["stylo"]
    if 'STYLO_THREADS' in os.environ and os.environ['STYLO_THREADS'] == '1':
        suite['extraOptions'] = ["stylo-sequential"]
    update_checkpoint_paths(
        glob.glob(os.path.join(data_path, "memory-report*")))

    total = 0
    for checkpoint in CHECKPOINTS:
        memory_report_path = os.path.join(data_path, checkpoint['path'])

        if node != "resident":
            totals = parse_about_memory.calculate_memory_report_values(
                memory_report_path, node)
            value = sum(totals.values())
        else:
            # For "resident" we really want RSS of the chrome ("Main") process
            # and USS of the child processes. We'll still call it resident
            # for simplicity (it's nice to be able to compare RSS of non-e10s
            # with RSS + USS of e10s).
            totals_rss = parse_about_memory.calculate_memory_report_values(
                memory_report_path, node, 'Main')
            totals_uss = parse_about_memory.calculate_memory_report_values(
                memory_report_path, 'resident-unique')
            value = totals_rss.values()[0] + \
                    sum([v for k, v in totals_uss.iteritems() if not 'Main' in k])

        subtest = {
            'name': checkpoint['name'],
            'value': value,
            'lowerIsBetter': True,
            'units': 'bytes'
        }
        suite['subtests'].append(subtest)
        total += math.log(subtest['value'])

    # Add the geometric mean. For more details on the calculation see:
    #   https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
    suite['value'] = math.exp(total / len(CHECKPOINTS))

    return suite
Example #2
0
def create_suite(name, node, data_path):
    """
    Creates a suite suitable for adding to a perfherder blob. Calculates the
    geometric mean of the checkpoint values and adds that to the suite as
    well.

    :param name: The name of the suite.
    :param node: The path of the data node to extract data from.
    :param data_path: The directory to retrieve data from.
    """
    suite = {
        'name': name,
        'subtests': [],
        'lowerIsBetter': True,
        'units': 'bytes'
    }
    if 'STYLO_FORCE_ENABLED' in os.environ and os.environ['STYLO_FORCE_ENABLED']:
        suite['extraOptions'] = ["stylo"]
    if 'STYLO_FORCE_DISABLED' in os.environ and os.environ['STYLO_FORCE_DISABLED']:
        suite['extraOptions'] = ["stylo-disabled"]
    if 'STYLO_THREADS' in os.environ and os.environ['STYLO_THREADS'] == '1':
        suite['extraOptions'] = ["stylo-sequential"]
    update_checkpoint_paths(glob.glob(os.path.join(data_path, "memory-report*")))

    total = 0
    for checkpoint in CHECKPOINTS:
        memory_report_path = os.path.join(data_path, checkpoint['path'])

        if node != "resident":
            totals = parse_about_memory.calculate_memory_report_values(
                                            memory_report_path, node)
            value = sum(totals.values())
        else:
            # For "resident" we really want RSS of the chrome ("Main") process
            # and USS of the child processes. We'll still call it resident
            # for simplicity (it's nice to be able to compare RSS of non-e10s
            # with RSS + USS of e10s).
            totals_rss = parse_about_memory.calculate_memory_report_values(
                                            memory_report_path, node, 'Main')
            totals_uss = parse_about_memory.calculate_memory_report_values(
                                            memory_report_path, 'resident-unique')
            value = totals_rss.values()[0] + \
                    sum([v for k, v in totals_uss.iteritems() if not 'Main' in k])

        subtest = {
            'name': checkpoint['name'],
            'value': value,
            'lowerIsBetter': True,
            'units': 'bytes'
        }
        suite['subtests'].append(subtest);
        total += math.log(subtest['value'])

    # Add the geometric mean. For more details on the calculation see:
    #   https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
    suite['value'] = math.exp(total / len(CHECKPOINTS))

    return suite
Example #3
0
def create_suite(
    name, node, data_path, checkpoints=CHECKPOINTS, alertThreshold=None, extra_opts=None
):
    """
    Creates a suite suitable for adding to a perfherder blob. Calculates the
    geometric mean of the checkpoint values and adds that to the suite as
    well.

    :param name: The name of the suite.
    :param node: The path of the data node to extract data from.
    :param data_path: The directory to retrieve data from.
    :param checkpoints: Which checkpoints to include.
    :param alertThreshold: The percentage of change that triggers an alert.
    """
    suite = {"name": name, "subtests": [], "lowerIsBetter": True, "unit": "bytes"}

    if alertThreshold:
        suite["alertThreshold"] = alertThreshold

    opts = []
    if extra_opts:
        opts.extend(extra_opts)

    # The stylo attributes override each other.
    stylo_opt = None
    if "STYLO_FORCE_ENABLED" in os.environ and os.environ["STYLO_FORCE_ENABLED"]:
        stylo_opt = "stylo"
    if "STYLO_THREADS" in os.environ and os.environ["STYLO_THREADS"] == "1":
        stylo_opt = "stylo-sequential"

    if stylo_opt:
        opts.append(stylo_opt)

    if "DMD" in os.environ and os.environ["DMD"]:
        opts.append("dmd")

    if extra_opts:
        suite["extraOptions"] = opts

    update_checkpoint_paths(
        glob.glob(os.path.join(data_path, "memory-report*")), checkpoints
    )

    total = 0
    for checkpoint in checkpoints:
        memory_report_path = os.path.join(data_path, checkpoint["path"])

        name_filter = checkpoint.get("name_filter", None)
        if checkpoint.get("median"):
            process = median
        else:
            process = sum

        if node != "resident":
            totals = parse_about_memory.calculate_memory_report_values(
                memory_report_path, node, name_filter
            )
            value = process(totals.values())
        else:
            # For "resident" we really want RSS of the chrome ("Main") process
            # and USS of the child processes. We'll still call it resident
            # for simplicity (it's nice to be able to compare RSS of non-e10s
            # with RSS + USS of e10s).
            totals_rss = parse_about_memory.calculate_memory_report_values(
                memory_report_path, node, ["Main"]
            )
            totals_uss = parse_about_memory.calculate_memory_report_values(
                memory_report_path, "resident-unique"
            )
            value = totals_rss.values()[0] + sum(
                [v for k, v in totals_uss.iteritems() if "Main" not in k]
            )

        subtest = {
            "name": checkpoint["name"],
            "value": value,
            "lowerIsBetter": True,
            "unit": "bytes",
        }
        suite["subtests"].append(subtest)
        total += math.log(subtest["value"])

    # Add the geometric mean. For more details on the calculation see:
    #   https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
    suite["value"] = math.exp(total / len(checkpoints))

    return suite
Example #4
0
def create_suite(name, node, data_path, checkpoints=CHECKPOINTS, alertThreshold=None):
    """
    Creates a suite suitable for adding to a perfherder blob. Calculates the
    geometric mean of the checkpoint values and adds that to the suite as
    well.

    :param name: The name of the suite.
    :param node: The path of the data node to extract data from.
    :param data_path: The directory to retrieve data from.
    :param checkpoints: Which checkpoints to include.
    :param alertThreshold: The percentage of change that triggers an alert.
    """
    suite = {
        'name': name,
        'subtests': [],
        'lowerIsBetter': True,
        'units': 'bytes'
    }

    if alertThreshold:
        suite['alertThreshold'] = alertThreshold

    extra_opts = []
    # The stylo attributes override each other.
    if 'STYLO_FORCE_ENABLED' in os.environ and os.environ['STYLO_FORCE_ENABLED']:
        extra_opts = ["stylo"]
    if 'STYLO_THREADS' in os.environ and os.environ['STYLO_THREADS'] == '1':
        extra_opts = ["stylo-sequential"]

    if 'DMD' in os.environ and os.environ['DMD']:
        extra_opts.append("dmd")

    if extra_opts:
        suite['extraOptions'] = extra_opts

    update_checkpoint_paths(glob.glob(os.path.join(data_path, "memory-report*")), checkpoints)

    total = 0
    for checkpoint in checkpoints:
        memory_report_path = os.path.join(data_path, checkpoint['path'])

        name_filter = checkpoint.get('name_filter', None)
        if checkpoint.get('median'):
            process = median
        else:
            process = sum

        if node != "resident":
            totals = parse_about_memory.calculate_memory_report_values(
                                            memory_report_path, node, name_filter)
            value = process(totals.values())
        else:
            # For "resident" we really want RSS of the chrome ("Main") process
            # and USS of the child processes. We'll still call it resident
            # for simplicity (it's nice to be able to compare RSS of non-e10s
            # with RSS + USS of e10s).
            totals_rss = parse_about_memory.calculate_memory_report_values(
                                            memory_report_path, node, 'Main')
            totals_uss = parse_about_memory.calculate_memory_report_values(
                                            memory_report_path, 'resident-unique')
            value = totals_rss.values()[0] + \
                sum([v for k, v in totals_uss.iteritems() if 'Main' not in k])

        subtest = {
            'name': checkpoint['name'],
            'value': value,
            'lowerIsBetter': True,
            'units': 'bytes'
        }
        suite['subtests'].append(subtest)
        total += math.log(subtest['value'])

    # Add the geometric mean. For more details on the calculation see:
    #   https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
    suite['value'] = math.exp(total / len(checkpoints))

    return suite