Less known Solaris features: ptime

Long time readers of my blog know that i’m preferring prstat over top at any time. The micro state accounting in prstat gives you a much deeper insight. Using a tool not capable to use microstate accounting is like looking a video in 240p instead of 4k ultra hd (to stay at this: dtrace is like 8k ;) ). prstat is doing a really useful job in telling you what’s happening at the moment in a processes. However sometimes it’s interesting to know, what happened in the past since the startup of the process. And there is a tool that is doing this. With ptimes -m you can lookup the information of the micro state accounting since the creation of the process:

root@kusanagi:~# ps -ef | grep "ssh"
jmoekamp  6174  6173   0 19:57:24 ?           0:00 /usr/lib/ssh/sshd
    root  6200  6188   0 19:59:06 pts/1       0:00 grep ssh
    root   539     1   0   Mai 01 ?           0:00 /usr/lib/ssh/sshd
    root  6173   539   0 19:57:24 ?           0:00 /usr/lib/ssh/sshd
root@kusanagi:~# ptime -m -p 6174

real     1:52.355845038
user        0.060116522
sys         0.049137178
trap        0.000004847
tflt        0.000000000
dflt        0.000000000
kflt        0.000000000
lock        0.000000000
slp      1:52.216832767
lat         0.029398950
stop        0.000010032

I’m using the tool quite often to get snapshots of the values for a process, writing it to a file and calculating the differences let’s say over multiple hours. For this task it’s much more practical than using prstat. A description of the values is in the man page, however it’s pretty much the same as in prstat -m

Do you want to learn more

docs.oracle.com - manpage - ptime(1)