stat.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 09 Feb 2011 11:53:01 +0200
changeset 849 a4f076bb0a8a
parent 198 e9f649ad236b
child 982 028a99668263
permissions -rw-r--r--
Width settings.

-*- mode: outline; coding: utf-8 -*-

* Cpu consumption.

** Linux.

*** Interactive.

  $ top

*** Static.

  $ ps -eo %cpu,pid,cmd --sort=%cpu

** FreeBSD.

*** Interactive.

  $ top

** Windows.

  cmd> taskmgr

** Solaris.

See

  http://developers.sun.com/solaris/articles/prstat.html
                Topping top in Solaris 8 with prstat.

*** Interactive.

  $ perfmeter

*** Static.

  $ prstat

  $ mpstat <num> <seconds>

* Memory consumption.

** Linux.

*** Interactive.

  $ top

*** Static.

Vitual and resident memory size:

  $ ps -eo vsz,rsz,pid,cmd --sort=vsz --width 3000

Swap size and usage:

  $ free

** FreeBSD.

*** Interactive.

  $ top

*** Static.

Swap size:

  $ swapinfo
  $ pstat -s

Swap usage:

  $ vmstat

** Solaris.

  $ sar -g

  $ vmstat

  $ prstat -s size

** Windows.

  cmd> taskmgr

and add colums TODO.

** Solaris.

  $ prstat -a

* Opened file by process.

** Linux.

  $ lsof -p <pid>

** FreeBSD.

  $ fstat -p <pid>

** Windows.

*** Interactive.

procexp.exe from Sysinternals.

*** Static.

handle.exe from Sysinternals:

  cmd> handle -p 1265
  C: File  (RW-)   C:\Program Files\Common Files\GTK\2.0\bin
288: Section       \BaseNamedObjects\mmGlobalPnpInfo

* Opened file by user.

** FreeBSD.

  $ fstat -u <user>

* Opened network connection by process.

** Linux.

  $ lsof -i[46][protocol][@{hostname|hostaddr}][:{service|port}]

46 - IPV4 or IPV6
protocol - tcp, udp

** FreeBSD.

** Windows.

  cmd> netstat -o
Type Local addr   Remote addr        State         PID
TCP  user:1154    localhost:1153     ESTABLISHED   1512
TCP  user:5152    localhost:1052     CLOSE_WAIT    1524
TCP  user:1036    services.int:5222  ESTABLISHED   1188

* Locked file by process.

** Linux.

  $ lsof <file>

** FreeBSD.

TODO

** Solaris.

TODO

** Windows.

*** Interactive.

procexp.exe from Sysinternals.

*** Static.

handle.exe from Sysinternals:

  cmd> handle d:\home
ispell.exe         pid: 244     784: D:\home\drivers\token_api\src
Far.exe            pid: 432     10C: D:\home\drivers\token_api