@3dsource/angular-unreal-module 0.0.184 → 0.0.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7703,19 +7703,35 @@ class StreamStatusTelemetryService2 {
|
|
|
7703
7703
|
}
|
|
7704
7704
|
aggregate(values) {
|
|
7705
7705
|
if (values.length === 0)
|
|
7706
|
-
return { p50: 0, p95: 0, min: 0, max: 0 };
|
|
7706
|
+
return { p50: 0, p95: 0, p05: 0, min: 0, max: 0 };
|
|
7707
7707
|
const sorted = [...values].sort((a, b) => a - b);
|
|
7708
|
-
//
|
|
7709
|
-
//
|
|
7710
|
-
//
|
|
7711
|
-
//
|
|
7708
|
+
// Linear interpolation between order statistics (the "type 7" method:
|
|
7709
|
+
// Excel's PERCENTILE, NumPy's default, and — deliberately — the same
|
|
7710
|
+
// maths the telemetry viewer's PHP `percentile()` uses, so a window
|
|
7711
|
+
// percentile and a population percentile are never two different
|
|
7712
|
+
// definitions of the word.
|
|
7713
|
+
//
|
|
7714
|
+
// This replaced nearest-rank (`sorted[ceil(p/100 * n) - 1]`), which
|
|
7715
|
+
// cannot express a low tail at these window sizes: ceil(0.05 * n) is 1
|
|
7716
|
+
// for every n ≤ 20, so p05 would have been an alias for `min` — one
|
|
7717
|
+
// dropped frame defining the whole window, which is the thing p05 exists
|
|
7718
|
+
// to avoid. It also biased p50 high by half a rank (sorted[9] of 20
|
|
7719
|
+
// rather than the midpoint of sorted[9] and sorted[10]).
|
|
7720
|
+
//
|
|
7721
|
+
// p95 stays distinct from `max`, which was the reason nearest-rank used
|
|
7722
|
+
// `ceil - 1`: at n = 20 the rank is 18.05, i.e. just above sorted[18].
|
|
7712
7723
|
const pick = (p) => {
|
|
7713
|
-
const
|
|
7714
|
-
|
|
7724
|
+
const rank = (p / 100) * (sorted.length - 1);
|
|
7725
|
+
const lo = Math.floor(rank);
|
|
7726
|
+
const hi = Math.ceil(rank);
|
|
7727
|
+
if (lo === hi)
|
|
7728
|
+
return sorted[lo];
|
|
7729
|
+
return sorted[lo] + (sorted[hi] - sorted[lo]) * (rank - lo);
|
|
7715
7730
|
};
|
|
7716
7731
|
return {
|
|
7717
7732
|
p50: pick(50),
|
|
7718
7733
|
p95: pick(95),
|
|
7734
|
+
p05: pick(5),
|
|
7719
7735
|
min: sorted[0],
|
|
7720
7736
|
max: sorted[sorted.length - 1],
|
|
7721
7737
|
};
|