Display kernel profile of currently executing functions in Solaris.

lockstat -I -i 977 -s 30 -h sleep 1 > /tmp/profile.out
Lockstat will sample the kernel 977 times per second, and print out the functions that it sees executing on the CPU during the sample. The -s 10 switch tells lockstsat to not only print that function, but also show the call stack (up to 10 deep).
Sample Output
Example output of a kernel doing TCP/IP work

Count indv cuml rcnt     nsec CPU+PIL                Caller
    1   0% 100% 0.00     2704 cpu[4]+11              disp_lock_enter_high

      nsec ------ Time Distribution ------ count     Stack
      4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1         setfrontdq+0x19c
                                                     sleepq_wakeone_chan+0x70
                                                     cv_signal+0x58
                                                     clnt_dispatch_notify+0x18c
                                                     mir_do_rput+0x374
                                                     putnext+0x218
                                                     tcp_rcv_drain+0xe0
                                                     tcp_rput_data+0x2df0
                                                     squeue_drain+0x130

2
2009-03-13 13:17:53

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: