diff --git a/kernel/lib_timing.h b/kernel/lib_timing.h index 51cd6922..8c346113 100644 --- a/kernel/lib_timing.h +++ b/kernel/lib_timing.h @@ -158,6 +158,7 @@ struct threshold { int thr_factor; // in % int thr_plus; // in us // statistical + int thr_max; // in ms int thr_triggered; int thr_true_hit; }; @@ -165,7 +166,10 @@ struct threshold { extern inline void threshold_check(struct threshold *thr, long long latency) { + int ms = latency >> 6; // ignore small rounding error while (thr) { + if (ms > thr->thr_max) + thr->thr_max = ms; if (thr->thr_limit && latency > (long long)thr->thr_limit * 1000) { thr->thr_triggered++; diff --git a/kernel/sy_old/mars_proc.c b/kernel/sy_old/mars_proc.c index 22435e67..b4f26e93 100644 --- a/kernel/sy_old/mars_proc.c +++ b/kernel/sy_old/mars_proc.c @@ -220,6 +220,7 @@ EXPORT_SYMBOL_GPL(mars_max_loadavg); INT_ENTRY(PREFIX "_threshold_us", (VAR)->thr_limit, 0600), \ INT_ENTRY(PREFIX "_factor_percent", (VAR)->thr_factor, 0600), \ INT_ENTRY(PREFIX "_plus_us", (VAR)->thr_plus, 0600), \ + INT_ENTRY(PREFIX "_max_ms", (VAR)->thr_max, 0600), \ INT_ENTRY(PREFIX "_triggered", (VAR)->thr_triggered,0400), \ INT_ENTRY(PREFIX "_true_hit", (VAR)->thr_true_hit, 0400) \