Input: a line window=W enter=E exit=X k=K, then request latencies in ms (whitespace-separated, in arrival order).
Process tumbling windows of W requests (ignore an incomplete last window). For each window compute mean, p50 and p95 (np.percentile, default interpolation). Count consecutive windows with p95 > E; when not alerting and that count reaches K, turn the alert on ( ALERT ON suffix with two spaces); when alerting and p95 < X, turn it off ( alert cleared). Print window 3: mean 222, p50 120, p95 396 ms ALERT ON (values with 0 decimals), then alerts fired: 1, alert active at end: no and overall mean 142 ms vs overall p95 371 ms.