stat.rst
changeset 2400 bdff41e50608
parent 2230 9e6ad6607a9e
equal deleted inserted replaced
2399:ed213cf36a1c 2400:bdff41e50608
     1 .. -*- coding: utf-8; -*-
     1 .. -*- coding: utf-8; -*-
     2 
     2 
     3 =========================
     3 ========================
     4  OS resource statistics.
     4  OS resource statistics
     5 =========================
     5 ========================
     6 .. contents::
     6 .. contents::
     7    :local:
     7    :local:
     8 
     8 
     9 Process list.
     9 Process list
    10 =============
    10 ============
    11 
    11 
    12 Linux.
    12 Linux
    13 ------
    13 -----
    14 
    14 
    15 View current user process::
    15 View current user process::
    16 
    16 
    17   $ ps
    17   $ ps
    18 
    18 
   116 
   116 
   117 Run as another user::
   117 Run as another user::
   118 
   118 
   119   $ runas /u: TODO XXX
   119   $ runas /u: TODO XXX
   120 
   120 
   121 CPU consumption.
   121 CPU consumption
   122 ================
   122 ===============
   123 
   123 
   124 Linux interactive.
   124 Linux interactive
   125 ------------------
   125 -----------------
   126 ::
   126 ::
   127 
   127 
   128   $ top
   128   $ top
   129   $ dstat
   129   $ dstat
       
   130   $ nmon
   130 
   131 
   131 Try press 's' (strace), 'l' (lsof), 'F5' (tree view) in::
   132 Try press 's' (strace), 'l' (lsof), 'F5' (tree view) in::
   132 
   133 
   133   $ htop
   134   $ htop
   134 
   135 
   135 http://htop.sourceforge.net/
   136 http://htop.sourceforge.net/
   136   Home page.
   137   Home page.
   137 
   138 
   138 Linux static.
   139 Linux static
   139 -------------
   140 ------------
   140 
   141 
   141 Number of cores::
   142 Number of cores::
   142 
   143 
   143   $ nproc
   144   $ nproc
   144 
   145 
   154 
   155 
   155 CPU context switches::
   156 CPU context switches::
   156 
   157 
   157   $ pidstat -w
   158   $ pidstat -w
   158 
   159 
   159 FreeBSD interactive.
   160 FreeBSD interactive
   160 --------------------
   161 -------------------
   161 ::
   162 ::
   162 
   163 
   163   $ top
   164   $ top
   164 
   165 
   165 Windows.
   166 Windows
   166 --------
   167 -------
   167 ::
   168 ::
   168 
   169 
   169   cmd> taskmgr
   170   cmd> taskmgr
   170 
   171 
   171 Solaris.
   172 Solaris
   172 --------
   173 -------
   173 
   174 
   174 Interactive::
   175 Interactive::
   175 
   176 
   176   $ perfmeter
   177   $ perfmeter
   177 
   178 
   182   $ mpstat <num> <seconds>
   183   $ mpstat <num> <seconds>
   183 
   184 
   184 http://developers.sun.com/solaris/articles/prstat.html
   185 http://developers.sun.com/solaris/articles/prstat.html
   185   Topping top in Solaris 8 with prstat.
   186   Topping top in Solaris 8 with prstat.
   186 
   187 
   187 Memory consumption.
   188 Memory consumption
   188 ===================
   189 ==================
   189 
   190 
   190 Linux interactive.
   191 Linux interactive
   191 ------------------
   192 -----------------
   192 ::
   193 ::
   193 
   194 
   194   $ top
   195   $ top
   195   $ dstat
   196   $ dstat
   196 
   197   $ nmon
   197 Linux static.
   198 
   198 -------------
   199 Linux static
       
   200 ------------
   199 
   201 
   200 Vitual and resident memory size per process::
   202 Vitual and resident memory size per process::
   201 
   203 
   202   $ ps -eo vsz,rsz,pid,cmd --sort=vsz --width 3000
   204   $ ps -eo vsz,rsz,pid,cmd --sort=vsz --width 3000
   203 
   205 
   222   $ cat /proc/pagetypeinfo
   224   $ cat /proc/pagetypeinfo
   223   $ cat /proc/buddyinfo
   225   $ cat /proc/buddyinfo
   224   $ sudo cat /proc/slabinfo
   226   $ sudo cat /proc/slabinfo
   225   $ sudo slabtop
   227   $ sudo slabtop
   226 
   228 
       
   229 Memory limits inside container::
       
   230 
       
   231   cat /sys/fs/cgroup/memory/memory.limit_in_bytes
       
   232   cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
       
   233 
   227 Shared memory segments::
   234 Shared memory segments::
   228 
   235 
   229   $ ipcs -m -p
   236   $ ipcs -m -p
   230 
   237 
   231 Process memory map::
   238 Process memory map::