Edit

kc3-lang/angle/src/tests/py_utils/angle_metrics.py

Branch :

  • Show log

    Commit

  • Author : Roman Lavrov
    Date : 2023-01-09 12:17:17
    Hash : 2b1bc4fd
    Message : Upload angle metrics to the gs bucket in skia perf format. ConvertToSkiaPerf converts the data format from angle_metrics.json to what skia perf ingests. Injestion happens automatically when the gs bucket is updated. Example data from this CL on non-perf bots with upload enabled (smoke mode so actual values aren't meaningful): https://angle-perf.skia.org/e/?queries=buildername%3Dlinux-test%26metric%3Dwall_time%26test%3Dtrex_200 Bug: angleproject:7299 Change-Id: Ica700b586e08c205968fbc3c1d15cf742ad537f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4148167 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>

  • src/tests/py_utils/angle_metrics.py
  • # Copyright 2023 The ANGLE Project Authors. All rights reserved.
    # Use of this source code is governed by a BSD-style license that can be
    # found in the LICENSE file.
    #
    # Utility for handling ANGLE perf metrics, separate file as it's
    # called by both the test runner and the post-processing script.
    
    import collections
    import json
    import logging
    import statistics
    
    
    def ConvertToSkiaPerf(angle_metrics_json_files):
        grouped_results = collections.defaultdict(list)
        for fn in angle_metrics_json_files:
            with open(fn) as f:
                metrics = json.load(f)
                for group in metrics:
                    for d in group:
                        k = (('suite', d['name']), ('renderer', d['backend'].lstrip('_')),
                             ('test', d['story']), ('metric', d['metric'].lstrip('.')), ('units',
                                                                                         d['units']))
                        grouped_results[k].append(float(d['value']))
    
        results = []
        for k, v in grouped_results.items():
            results.append({
                'key': dict(k),
                'measurements': {
                    'stat': [{
                        'value': 'mean',
                        'measurement': statistics.mean(v),
                    }, {
                        'value': 'stdev',
                        'measurement': statistics.stdev(v) if len(v) > 1 else 0,
                    }],
                },
            })
    
        logging.info('angle_metrics to skia perf: %d entries' % len(results))
    
        return results