k4bench.analysis.trend¶
k4bench.analysis.trend ¶
Pure, Streamlit-free trend aggregation over benchmark run directories.
Each build_*_trend function takes the already date-windowed set of cached
run directories (see :func:k4bench.remote.fetch_runs_windowed) and returns a
long-form DataFrame keyed by run_id / x_date (nightly tag), or None
when no data could be loaded. The dashboard wraps these in @st.cache_data
(see dashboard/data.py); the nightly regression report calls them directly
from CI, which is why they must not import Streamlit.
upper_trimmed_mean ¶
Mean of times with the slowest fraction of events dropped.
A run total is a sum of per-event costs, and where that distribution is heavy-tailed a handful of events carry a disproportionate share of it. That makes the plain mean a statistic about the tail as much as about the software. Dropping the slow tail leaves a statistic about the typical event, which moves when the typical event's cost moves and not otherwise.
Deliberately a complement to the untrimmed mean, never a replacement: the same tail that destabilises the mean is where a tail-confined regression would show up first, so a detector that only watched this would be blind to exactly the most interesting kind of change.
Returns None for fewer than :data:MIN_TRIM_EVENTS events, where the
trim would drop nothing and the value would merely duplicate the mean.
Source code in k4bench/analysis/trend.py
parse_run_dir ¶
Extract run metadata from a date-level run directory.
Expected path structure::
{detector}/{platform}/{stack}/{sample}/{YYYY-MM-DD}/
Prefers run_info.json when present; falls back to inferring fields
from the directory path.
Source code in k4bench/analysis/trend.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
load_machine_info ¶
Load machine_info.json from a run directory, or return None if absent.
Source code in k4bench/analysis/trend.py
build_results_trend ¶
Load per-config results across run_dirs into one combined DataFrame.
Each row gets run_id, run_date, platform, k4h_release,
k4h_release_date, github_run_url, random_seed and x_date
columns.
Source code in k4bench/analysis/trend.py
build_region_timing_trend ¶
Load per-region timing summary across run_dirs.
For each run directory, region timing is loaded for all available configs. Per detector per config per run, the median and mean event-level time are computed (event 0 excluded as warmup).
Returns a long-form DataFrame with columns:
run_id, run_date, k4h_release_date, label, attribution, detector,
median_time_s, mean_time_s
or None if no data could be loaded. run_id lets callers join each row
with its run's reliability verdict (see k4bench.results.reliability_evidence).
Source code in k4bench/analysis/trend.py
build_event_timing_trend ¶
Load per-event timing and memory summary across run_dirs.
For each run directory, event timing is loaded for all available configs. Per config per run, summary statistics are computed (event 0 excluded): mean_time_s, median_time_s, p95_time_s, trimmed_mean_time_s, mean_rss_mb, median_rss_mb, p95_rss_mb, max_rss_mb
trimmed_mean_time_s (:func:upper_trimmed_mean) is a view of the
typical event, unmoved by how heavy this run's slow tail happened to be. It
is absent (NaN) for a config with too few events to support it.
Returns a long-form DataFrame with those columns plus
run_id, run_date, k4h_release_date, k4h_release, label
or None if no data could be loaded. run_id lets callers join each row
with its run's reliability verdict (see k4bench.results.reliability_evidence).
Source code in k4bench/analysis/trend.py
build_machine_info_trend ¶
Load per-run machine load / memory metrics across run_dirs.
Unlike the other trend builders there is no per-config dimension: each run
directory has a single machine_info.json describing the physical machine
that executed the benchmark. One row per run captures the load average,
available RAM, swap, frequency and throttle counters, so callers can see how
the host's condition varied across nightly releases (e.g. a day where the
machine was under unusually high load).
Returns a DataFrame with one row per run plus run_id, run_date,
k4h_release_date, k4h_release and x_date columns, or None
if no machine info could be loaded. run_id lets callers join the
machine condition of a run with its per-config results (e.g. to attach a
reliability verdict to each run).