sched && syscall app state awareness basics

pgrep -f bash | while read PMATCH;do echo "$PMATCH # $(grep -e nr_involuntary_switches /proc/$PMATCH/sched|tr -d '\040\011\012\015') # [sysc]:$(ausyscall $(cat /proc/$PMATCH/syscall|cut -d' ' -f1))"; done;
example or test, basic awareness on app state, mostly for copy-paste reasons, requires auditd (ausyscall), rekt echoing (everything here is rekt)
Sample Output
1106 # nr_involuntary_switches:2 # [sysc]:pselect6
1857 # nr_involuntary_switches:3 # [sysc]:wait4
1912 # nr_involuntary_switches:3 # [sysc]:wait4
8901 # nr_involuntary_switches:0 # [sysc]:read
9186 # nr_involuntary_switches:2 # [sysc]:wait4
9238 # nr_involuntary_switches:24 # [sysc]:pselect6
14966 # nr_involuntary_switches:1 # [sysc]:wait4
15054 # nr_involuntary_switches:9 # [sysc]:wait4
21137 # nr_involuntary_switches:0 # [sysc]:wait4
21628 # nr_involuntary_switches:0 # [sysc]:pselect6
22719 # nr_involuntary_switches:0 # [sysc]:pselect6
28808 # nr_involuntary_switches:0 # [sysc]:wait4
30983 # nr_involuntary_switches:0 # [sysc]:wait4
31179 # nr_involuntary_switches:18 # [sysc]:pselect6

0
By: x0a
2018-10-29 20:06:05

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: