[PATCH 01/36] tuna: Warn when user-specified patterns match zero threads or IRQs
John Kacur <[email protected]> Fri, 10 Jul 2026 10:14:39 -0400
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
When a user specifies a thread or IRQ pattern that matches nothing, tuna previously showed only empty output with column headers. This left users uncertain whether their pattern syntax was incorrect, the pattern was valid but matched nothing, or something failed silently. Add feedback when patterns match zero results by printing a warning to stderr. This helps users debug their patterns and understand that tuna processed the pattern but found no matches. The warning appears for relevant commands (show_threads, show_irqs, move, spread, priority, what_is) only when the user explicitly specified a pattern (match_requested == True) and the resulting list is empty. Example: $ tuna show_threads -t 'foo*' tuna: warning: thread pattern matched 0 threads Assisted-by: Claude:claude-sonnet-4-5 Signed-off-by: John Kacur <[email protected]> --- tuna-cmd.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tuna-cmd.py b/tuna-cmd.py index 293044920223..015bb7a54663 100755 --- a/tuna-cmd.py +++ b/tuna-cmd.py @@ -712,6 +712,15 @@ def main(): if 'nohz_full' in vars(args) and args.nohz_full: args.cpu_list = nohz_full_to_cpu() + # Warn if user-specified patterns matched nothing + if match_requested: + if args.command in ['show_threads', 'move', 'm', 'spread', 'x', 'priority', 'p', 'what_is', 'W']: + if 'thread_list' in vars(args) and isinstance(args.thread_list, list) and not args.thread_list: + print("tuna: warning: thread pattern matched 0 threads", file=sys.stderr) + if args.command in ['show_irqs', 'move', 'm', 'spread', 'x']: + if 'irq_list' in vars(args) and isinstance(args.irq_list, list) and not args.irq_list: + print("tuna: warning: IRQ pattern matched 0 IRQs", file=sys.stderr) + # if args.command in ['apply', 'a']: # apply_config(args.profilename) -- 2.54.0