add --kernel-threads-only to tools/offcputime
Summary: Adds `--kernel-threads-only` arg The kernel-threads-only arg is exclusive with pid/user-threads-only via `parser.add_mutually_exclusive_group`. The output message now indicates what we are tracing (pid/user threads/kernel threads/all threads). Removed the --verbose arg (unused). Test Plan: Run with combinations of the args; validate output looks sane: // test mutually exclusive group ``` devbig680[bcc](abirchall_dev): ~/bcc_run_tool.sh offcputime -k -u 1 [Running] /data/users/abirchall/bcc/tools/offcputime.py -k -u 1 usage: offcputime.py [-h] [-p PID | -k | -u] [-v] [-f] [duration] offcputime.py: error: argument -u/--user-threads-only: not allowed with argument -k/--kernel-threads-only ``` // kernel threads only ``` devbig680[bcc](abirchall_dev): ~/bcc_run_tool.sh offcputime -f -k 1 [Running] /data/users/abirchall/bcc/tools/offcputime.py -f -k 1 swapper/21;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 11 swapper/16;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 19 swapper/22;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 20 swapper/31;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 20 swapper/23;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 67 swapper/25;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 74 ... ``` `~/bcc_run_tool.sh offcputime -f --kernel-threads-only 1` // user threads only `~/bcc_run_tool.sh offcputime -f --user-threads-only 1` `~/bcc_run_tool.sh offcputime -f -u 1` // specific pid `~/bcc_run_tool.sh offcputime -f -p $(pidof hphpi) 1` ``` devbig680[bcc](abirchall_dev): ~/bcc_run_tool.sh offcputime --pid $(pidof mcrouter) 10 | head [Running] /data/users/abirchall/bcc/tools/offcputime.py --pid 95929 10 Tracing off-CPU time (us) of PID 95929 by kernel stack for 10 secs. ``` Note that this last case (specific PID) doesn't appear to be working; I can debug that in a follow up commit.
Showing
Please register or sign in to comment