Skip to content

Commit 66dab82

Browse files
committed
latency: skip RT-privilege warning on non-RT kernels
Only warn under PREEMPT_RT or RTAI; on a non-RT kernel the privileges do not matter, so the check would be noise.
1 parent dc190d7 commit 66dab82

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/latency-histogram

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ proc check_rt_privileges {} {
115115
# Without 'sudo make setuid' (or 'sudo make setcap') rtapi_app runs
116116
# unprivileged: realtime threads get no SCHED_FIFO and no locked memory, so
117117
# the latency readings are wildly inflated. Warn rather than mislead.
118+
# Only meaningful on an RT-capable kernel; stay quiet on non-RT (e.g. dev).
119+
set rt 0
120+
if {![catch {exec uname -v} kv] && [string match *PREEMPT_RT* $kv]} {set rt 1}
121+
if {[string first rtai [string tolower $::tcl_platform(osVersion)]] >= 0} {set rt 1}
122+
if {!$rt} return
118123
if {![catch {exec id -u} uid] && $uid == 0} return ;# root has every privilege
119124
if {[catch {which_exe rtapi_app} rtapi]} return ;# cannot locate, stay quiet
120125
if {![catch {file attributes $rtapi -permissions} mode] && ($mode & 04000)} return ;# setuid root

scripts/latency-test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ icalc() { awk "BEGIN { printf \"%.0f\n\", ($1); }" < /dev/null; }
2020
# unprivileged: realtime threads get no SCHED_FIFO and no locked memory, so the
2121
# latency readings are wildly inflated. Warn rather than mislead.
2222
check_rt_privileges () {
23+
# only meaningful on an RT-capable kernel; stay quiet on non-RT (e.g. dev)
24+
case "$(uname -v) $(uname -r)" in
25+
*PREEMPT_RT*|*rtai*) ;;
26+
*) return 0 ;;
27+
esac
2328
[ "$(id -u)" = 0 ] && return 0 # root has every privilege
2429
rtapi_app=$(command -v rtapi_app) || return 0
2530
[ -n "$rtapi_app" ] || return 0

0 commit comments

Comments
 (0)