Unverified Commit c9860ef9 authored by Philip Taron's avatar Philip Taron
Browse files

ci.eval.compare: remove the duplicate cpuTime key

parent 2817f796
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@ def flatten_data(json_data: dict) -> dict:
    "gc.heapSize": 5404549120
    ...

    See https://github.com/NixOS/nix/blob/187520ce88c47e2859064704f9320a2d6c97e56e/src/libexpr/eval.cc#L2846
    for the ultimate source of this data.

    Args:
        json_data (dict): JSON data containing metrics.
    Returns:
@@ -31,6 +34,10 @@ def flatten_data(json_data: dict) -> dict:
    """
    flat_metrics = {}
    for key, value in json_data.items():
        # This key is duplicated as `time.cpu`; we keep that copy.
        if key == "cpuTime":
            continue

        if isinstance(value, (int, float)):
            flat_metrics[key] = value
        elif isinstance(value, dict):
@@ -80,7 +87,7 @@ def load_all_metrics(path: Path) -> dict:


def metric_sort_key(name: str) -> str:
    if name in ("cpuTime", "time.cpu", "time.gc", "time.gcFraction"):
    if name in ("time.cpu", "time.gc", "time.gcFraction"):
        return (1, name)
    elif name.startswith("gc"):
        return (2, name)