KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : andertr9 ( 1047)
PHP Version : 8.2.18
Disable Function : NONE
Directory :  /usr/share/dstat/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/dstat/dstat.pyo
�
Fq�Sc@s%ddlmZy�ddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZWne
k
r�nXdZidd6aejddfkr�ejd�nyeefWnek
rdZd	ZnXejddfko9ejdd
fkrHd�Zn!ejddfkrid�Znejdd
fkr�d
�Znejjd�ejjejjejd	��dddgZdfd��YZdfd��YZdefd��YZdefd��YZ defd��YZ!defd��YZ"defd��YZ#d efd!��YZ$d"efd#��YZ%d$efd%��YZ&d&efd'��YZ'd(efd)��YZ(d*efd+��YZ)d,efd-��YZ*d.efd/��YZ+d0efd1��YZ,d2efd3��YZ-d4efd5��YZ.d6efd7��YZ/d8efd9��YZ0d:efd;��YZ1d<efd=��YZ2d>efd?��YZ3d@efdA��YZ4dBefdC��YZ5dDefdE��YZ6dFefdG��YZ7dHefdI��YZ8dJefdK��YZ9dLefdM��YZ:dNefdO��YZ;i'dPdQ6dRdS6dTdU6dVdW6dXdY6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dldm6dndo6dpdq6drds6dtdu6dvdw6dxdy6dzd{6d|d}6d~d6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d6a<id�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6Z=d��Z>d��Z?d��Z@d��ZAd��ZBd��ZCd�d��ZDd�d��ZEd�d��ZFd��ZGd��ZHeId��ZJd��ZKeId��ZLd��ZMeId��ZNd��ZOd��ZPd��ZQd��ZRd��ZSd�d�d�d��ZTd��ZUd��ZVd��ZWd��ZXd��ZYd��ZZed��Z[d��Z\d��Z]d��Z^d��Z_d��Z`d��Zad��Zbd��Zcd��Zd��Zdd��Zeefd�kry�eY�eejd�age>�atgjhr�ddlhZhejjitgjh�r�ejjtgjh�nehjkd�tgjh�ned�Wn/e
k
rZltgjmr�ejnjod��nnXed	�ned�agdapdS(�i����(t
generatorsNs0.7.2ttdefaultis#error: Python 2.2 or later requirediiiccs0d}x#|D]}||fV|d}q
WdS(Nii((tsequencetindextitem((s/usr/share/dstat/dstat.pyt	enumerate*s
cCs>d}g}x+|D]#}|j||f�|d}qW|S(Nii(tappend(RRtseqlistR((s/usr/share/dstat/dstat.pyR0s
cCs%d}x|D]}||}q
W|S(Ni((Rtretti((s/usr/share/dstat/dstat.pytsum;s
s	~/.dstat/s	/plugins/s/usr/share/dstat/s/usr/local/share/dstat/tOptionscBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs�||_t|_t|_d|_d|_d|_d|_d|_	t|_
t|_t|_d|_
d|_d|_t|_t|_t|_t|_t|_d|_t�}g|_tjj�s�t|_t|_t|_nidod6dpd6dqd6|_yetj|dddddddddddddddddd d!d"d#d$d%g|�\}}Wn2tjk
r�}d&t|�GHtj d�nXx:|D]2\}}|drkr�|jj!d(�q�|dskr�|j"d*�|_q�|dtkr|jj!d,�q�|dukr>|j#|�|_	q�|dvkr]|jj!d/�q�|dwkr||jj!d1�q�|dxkr�|jj!d3�q�|dykr�|j"d*�|_
q�|dzkr�|jj!d6�q�|d{kr�|jj!d8�q�|d|krJtj$d<|d=j%|j"d*��fIJ|j|j"d*�7_q�|d}kri|jj!d?�q�|d~kr�|j"d*�|_q�|dkr�|jj!dB�q�|d�kr�|jj!dD�q�|d�kr�|jj!dF�q�|d�kr|j"d*�|_q�|d�kr'|jj!dI�q�|d�krF|jj!dK�q�|d�kre|jj!dM�q�|d�kr�|jd(d,d?d1dMg7_q�|d�kr�|jdBd8d1d,dMd(g7_q�|d�kr�t|_
q�|d�krij&|�j'�}|j(�|j|7_q�|d�kr/t|_q�|d�krGt|_q�|d�krf|jd|_q�|d�kr~t|_q�|d�kr�t|_q�|d�kr�t)�tj d�q�|d�kr�t|_t|_q�|d�kr�t|_q�|d�kr
t|_q�|d�kr"||_q�|d�kr:||_q�|d�krRdc|_q�|d�kr�|j*�|j+�tj d�q�|d�kr�|j,�tj d�q�|j-dh�r�|jj!|di�q�dj|GHtj d�q�W|jr|jrdkGHtj d�n|js8dlGHd(d,d?d1dMg|_nyTt.|�dkrct/|d�|_nt.|�dkr�t/|d�|_nWndmGHtj d�nX|jdkr�dnGHtj d�ndS(�Ni����iiRtsdashd[a-d]tlocalssd[b-k]ssd[v-z]ssda[a-e]tloresssd[l-u]ssda[f-o]thiress acdfghilmno:prstTvyC:D:I:M:N:S:Vtallsall-pluginstbitstbwtblackonwhitetdebugt
filesystemtfloattfullthelptintegertlisttmodstmodulestnocolort	noheaderstnoupdatesoutput=spidfile=tprofiletversiontvmstats5dstat: %s, try dstat -h for a list of all the optionss-ctcpus-Ct,s-dtdisks-Ds--filesystemtfss-gtpages-itints-Is-ltloads-mtmems-Ms--modss	--moduless9WARNING: Option %s is deprecated, please use --%s insteads --s-ntnets-Ns-ptprocs-rtios-stswaps-Ss-tttimes-Ttepochs-ytsyss-as--alls-vs--vmstats-fs--fulls
--all-pluginss--bitss--bws--black-on-whites--debugs--floats	--integers--lists	--nocolors--noheaderss
--noupdates-os--outputs	--pidfiles	--profilesdstat_profile.logs-hs--helps-Vs	--versions--isNdstat: option %s unknown to getopt, try dstat -h for a list of all the optionssOdstat: option --float and --integer are mutual exlusive, you can only force ones6You did not select any stats, using -cdngy by default.s>dstat: incorrect argument, try dstat -h for the correct syntaxs2dstat: delay must be an integer, greater than zero(R
shd[a-d](ssd[b-k]ssd[v-z]ssda[a-e](ssd[l-u]ssda[f-o](s-c(s-C(s-d(s-D(s--filesystem(s-g(s-i(s-I(s-l(s-m(s-Ms--modss	--modules(s-n(s-N(s-p(s-r(s-s(s-S(s-t(s-T(s-y(s-as--all(s-vs--vmstat(s-fs--full(s
--all-plugins(s--bits(s--bws--black-on-white(s--debug(s--float(s	--integer(s--list(s	--nocolor(s--noheaders(s
--noupdate(s-os--output(s	--pidfile(s	--profile(s-hs--help(s-Vs	--version(0targstFalseRRtcounttNonetcpulistRtdelaytdisklistRRRtintlisttnetlisttswaplisttTruetcolortupdatetheadertoutputtpidfileR!tlistpluginstpluginsR2tstdouttisattytdisksettgetoptterrortstrtexitRtsplittget_disklisttstderrtjointfromkeystkeystsorttshowpluginstusageRR"t
startswithtlenR)(tselfR3t
allpluginstoptstexctopttargRD((s/usr/share/dstat/dstat.pyt__init__Is"																								
&)!$
	


		cCs�|jd�}g}x�|D]�}|d dkr�tjj|�r�tjj|�r�tj|�}|ddkr�tjjtjj|�|�}tjj|�}nd||fGH|}n|d}|j	|�q�d|GHq|j	|�qW|S(NR%is/dev/it/sdstat: symlink %s -> %ssdstat: %s does not exist(
RLtostpathtexiststislinktreadlinkROtdirnametnormpathR(RWtdisksR9R	R&ttarget((s/usr/share/dstat/dstat.pyRM�s"
!	
cCs�dtGHdGHdGHHdtjtjfGHdtj�dGHdtjGHHd}t|j�sgd	}nd
tj	d�|fGHt
�\}}d||fGHHd
t�GHdtj
�GHdtjd�GHH|at�dS(NsDstat %ss&Written by Dag Wieers <dag@wieers.com>s2Homepage at http://dag.wieers.com/home-made/dstat/sPlatform %s/%ss	Kernel %sis	Python %sRsno s#Terminal type: %s (%scolor support)tTERMs#Terminal size: %d lines, %d columnssProcessors: %dsPagesize: %dsClock ticks per secs: %dt
SC_CLK_TCK(tVERSIONR_tnameR2tplatformtunameR"tgettermcolorR>tgetenvtgettermsizetgetcpunrtresourcetgetpagesizetsysconftopRS(RWR>trowstcols((s/usr/share/dstat/dstat.pyR"s*		cCs	dGHdS(Ns/Usage: dstat [-afv] [options..] [delay [count]]((RW((s/usr/share/dstat/dstat.pyRT!scCs	dGHdS(NsC	Versatile tool for generating system resource statistics

Dstat options:
  -c, --cpu              enable cpu stats
     -C 0,3,total           include cpu0, cpu3 and total
  -d, --disk             enable disk stats
     -D total,hda           include hda and total
  -g, --page             enable page stats
  -i, --int              enable interrupt stats
     -I 5,eth2              include int5 and interrupt used by eth2
  -l, --load             enable load stats
  -m, --mem              enable memory stats
  -n, --net              enable network stats
     -N eth1,total          include eth1 and total
  -p, --proc             enable process stats
  -r, --io               enable io stats (I/O requests completed)
  -s, --swap             enable swap stats
     -S swap1,total         include swap1 and total
  -t, --time             enable time/date output
  -T, --epoch            enable time counter (seconds since epoch)
  -y, --sys              enable system stats

  --aio                  enable aio stats
  --fs, --filesystem     enable fs stats
  --ipc                  enable ipc stats
  --lock                 enable lock stats
  --raw                  enable raw stats
  --socket               enable socket stats
  --tcp                  enable tcp stats
  --udp                  enable udp stats
  --unix                 enable unix stats
  --vm                   enable vm stats

  --plugin-name          enable plugins by plugin name (see manual)
  --list                 list all available plugins

  -a, --all              equals -cdngy (default)
  -f, --full             automatically expand -C, -D, -I, -N and -S lists
  -v, --vmstat           equals -pmgdsc -D total

  --bits                 force bits for values expressed in bytes
  --float                force float values on screen
  --integer              force integer values on screen

  --bw, --blackonwhite   change colors for white background terminal
  --nocolor              disable colors (implies --noupdate)
  --noheaders            disable repetitive headers
  --noupdate             disable intermediate updates
  --output file          write CSV output to file
  --profile              show profiling statistics when exiting dstat

delay is the delay in seconds between each update (default: 1)
count is the number of updates to display before exiting (default: unlimited)
((RW((s/usr/share/dstat/dstat.pyR$s6(t__name__t
__module__R]RMR"RTR(((s/usr/share/dstat/dstat.pyRHs
	�			tdstatcBs�eZdZdZdZdZdZdZdZ	d�Z
d�Zd�Zdd�Z
ddd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(tfiiicCs�t|j�r!|j�|_nt|j�rB|j�|_n|jsWtd�nt|j�rx|j�|_nt|j�r�|j�|_n|js�|j|_ni|_i|_i|_|j	dkrx�|jD])}d|j|<|j|<|j|<q�Wn�x�|jdgD]�}t
|j	�|j|<t
|j	�|j|<t
|j	�|j|<xFt
|j	�D]5}d|j||<|j||<|j||<q~Wq&WdS(NsNo counter objects to monitorittotal(tcallabletdiscovertvarst	ExceptionRktnicktvaltset1tset2Rwtrange(RWRkR
((s/usr/share/dstat/dstat.pytprepareis0					*cGs�g|_g|_xQ|D]I}y9t|�}|rW|jj|�|jj|�nWqqXqW|jstd|�ndS(sOpen stat file descriptorsCannot open file %sN(tfiletfdtdopenRR�(RWt	filenamestfilenameR�((s/usr/share/dstat/dstat.pytopen�s		
	ccsAx:|jD]/}|jd�x|j�D]}|Vq*Wq
WdS(s%Return lines from any file descriptoriN(R�tseekt	readlines(RWR�tline((s/usr/share/dstat/dstat.pyR��s
cCs5x.|jD]#}|jd�|j�j|�SWdS(Ni(R�R�treadRL(RWtsepR�((s/usr/share/dstat/dstat.pyt	splitline�s
ccs�x�|jD]�}|jd�xk|j�D]]}|rY|rY|j||�j|�Vq*|ry|j|d�j�Vq*|j|�Vq*Wq
WdS(s+Return split lines from any file descriptorit N(R�R�R�treplaceRL(RWR�R�R�R�((s/usr/share/dstat/dstat.pyt
splitlines�s
cCs]|jr1t|j�|j�t|j�dSt|j�|j�t|j�dSdS(sReturn complete stat widthiN(RwRVRtcolwidthR�(RW((s/usr/share/dstat/dstat.pyt	statwidth�s	(cCsEt|jtj�r|jSt|j�|jt|j�dSdS(sReturn column widthiN(t
isinstanceRkttypest
StringTypetwidthRVR�(RW((s/usr/share/dstat/dstat.pyR��scCstd}t|jtj�ra|j�}||jd|!j|td�jdd�tdSx�t	|j�D]�\}}|j
�}||d|!j|td�jdd�}|dt|j�krqtj
r�|tdtd	td}q
|td}qqqqW|S(
NttitleitspaceR�t-Ritframetdash(tthemeR�RkR�R�R�tcentertcharR�RR�RVRuR>(RWR	R�R
Rk((s/usr/share/dstat/dstat.pyR��s
6-	!cCs{d}t|jtj�r�x~t|j�D]m\}}|td|d|j!j|jt	d�td}|dt
|j�kr+|t	d}q+q+W|Sx�t|j�D]�\}}x~t|j�D]m\}}|td|d|j!j|jt	d�td}|dt
|j�kr�|t	d}q�q�W|dt
|j�kr�|tdt	d}q�q�W|SdS(	NRtsubtitleiR�RiR�tcolon(R�RkR�R�RR�R�R�R�R�RV(RWR	R
R�Rktj((s/usr/share/dstat/dstat.pyR��s77cCs�t|jtj�r9d|jddt|j�dSd}xjt|j�D]Y\}}|d|ddt|j�d}|dt|j�krO|d}qOqOW|SdS(Nt"R%iR(R�RkR�R�RVR�R(RWR	R
Rk((s/usr/share/dstat/dstat.pytcsvtitle�s$'cCsd}t|jtj�rwxUt|j�D]D\}}|d|d}|dt|j�kr+|d}q+q+W|Sx�t|j�D]�\}}xUt|j�D]D\}}|d|d}|dt|j�kr�|d}q�q�W|dt|j�kr�|d}q�q�W|SdS(NRR�iR%(R�RkR�R�RR�RV(RWR	R
R�RkR�((s/usr/share/dstat/dstat.pytcsvsubtitle�scCsG|jstd�n|js*td�n|j�r:tStd�dS(sCheck if stat is applicables$No objects found, no stats availables)No objects discovered, no stats availablesUnknown problem, please reportN(RR�R~R�R=(RW((s/usr/share/dstat/dstat.pytchecks		cGstS(N(R=(RWtobjlist((s/usr/share/dstat/dstat.pyR~
scCs!d}t|d�r4t|j|j|j|j�Sx�t|j�D]�\}}t|j	|t
j�s�t|j	|t
j�r�|t
|j	||j|j|j�}tdtd}n3|t|j	||j|j|j�}td}|dt|j�krD||}qDqDW|S(sDisplay stat resultsRRAR�R�R�i(thasattrtcprintRAttypeR�tscaleRRR�R�R�t	TupleTypetListTypet
cprintlistR�R�RV(RWR�R
RkR�((s/usr/share/dstat/dstat.pytshows2))
cCs@||dk	r tdtdS||kr<tdtdSdS(Ni����R�tpipetgtR(R�R�(RWttotlisttvislist((s/usr/share/dstat/dstat.pytshowend s
cCs0d�}d}xt|j�D]	\}}t|j|tj�s]t|j|tj�r�x�t|j|�D]F\}}|||�}|dt|j|�krq|d}qqqqWnDt|j|tj�r�||j|}n|||j|�}|dt|j�kr|d}qqW|S(NcSs(|t|�krd|Sdt|�S(Ns%.3fs%s(tround(tvar((s/usr/share/dstat/dstat.pytprintcsv(sRiR%(	RRR�R�R�R�R�RVR�(RWR�R�R
RkR�R�((s/usr/share/dstat/dstat.pytshowcsv's	2 cCs,||dk	rdS||dk	r(dSdS(Ni����R%R((RWR�R�((s/usr/share/dstat/dstat.pyt
showcsvend<s
N(RxRyR6RRkR�R�R�R�RwR�R�R�R�R�R�R�R�R�R�R�R�R~R�R�R�R�(((s/usr/share/dstat/dstat.pyRz]s0								
						t	dstat_aiocBseZd�Zd�ZRS(cCs>d|_d|_d|_d|_d|_|jd�dS(	Ntasyncs#aiotaiotdis/proc/sys/fs/aio-nr(s#aio(R�(RkR�RR�R�R�(RW((s/usr/share/dstat/dstat.pyR]Ds					cCsJxC|j�D]5}t|�dkr+q
nt|d�|jd<q
WdS(NiiR�(R�RVtlongR�(RWtl((s/usr/share/dstat/dstat.pytextractLs(RxRyR]R�(((s/usr/share/dstat/dstat.pyR�Cs	t	dstat_cpucBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs>d|_d|_d|_d	|_|jd
�d|_dS(
NtusrR2tidltwaithiqtsiqtpii"s
/proc/stati(R�ssysR�R�R�R�(R�R�R�R�R�Rw(RW((s/usr/share/dstat/dstat.pyR]Rs				
cGs�g}xX|j�D]J}t|�dks|ddd!dkrHqn|j|dd�qW|j�x|D]}|j|�qrW|S(NiiiR$(R�RVRRR(RWR�R	R�R((s/usr/share/dstat/dstat.pyR~Zs)

cCs�g}tjrtj}nNtjs-d}n<g}d}x-|tkrh|jt|��|d}q<Wx4|D],}||jdgkrp|j|�qpqpW|S(NR|ii(stotal(RuR7RtcpunrRRJR~(RWR	tvarlistR$Rk((s/usr/share/dstat/dstat.pyRcs			
cCsOg}xB|jD]7}|dkr2|jd�q|jd|d�qW|S(NR|stotal cpu usageR$s usage(RR(RWR	Rk((s/usr/share/dstat/dstat.pyRkuscCs�x�|j�D]�}t|�dkr+q
nx�|jD]�}|dd|ksk|ddkr5|dkr5t|d�t|d�t|d�t|d�t|d	�t|d
�t|d�f|j|<q5q5Wq
Wx�|jD]�}x�td
�D]�}t|j|�t|j|�kr|d|j|||j||t|j|�t|j|�|j||<q�d|j||<q�Wq�Wt	t
jkr�|jj|j�ndS(
NiiR$R|iiiiiiigY@(
R�RVRR�R�R�RR�R�tstepRuR8R?(RWR�RkR
((s/usr/share/dstat/dstat.pyR�~s0t&T(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR�Qs
						tdstat_cpu24cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs>d|_d|_d|_d|_|jd�d|_dS(	NR�R2R�R�ii"s
/proc/stat(susrssyssidl(R�R�R�R�R�Rw(RW((s/usr/share/dstat/dstat.pyR]�s				
cGs�g}xX|j�D]J}t|�dks|ddd!dkrHqn|j|dd�qW|j�x|D]}|j|�qrW|S(NiiiR$(R�RVRRR(RWR�R	R�R((s/usr/share/dstat/dstat.pyR~�s)

cCs�g}tjrtj}nNtjs-d}n<g}d}x-|tkrh|jt|��|d}q<Wx4|D],}||jdgkrp|j|�qpqpW|S(NR|ii(stotal(RuR7RR�RRJR~(RWR	R�R$Rk((s/usr/share/dstat/dstat.pyR�s			
cCsKg}x>|jD]3}|dkr2|jd�q|jd|�qW|S(NR|s	cpu usageR$(RR(RWR	Rk((s/usr/share/dstat/dstat.pyRk�sc	CsEx�|j�D]�}x�|jD]{}|dd|ksS|ddkr|dkrt|d�t|d�t|d�t|d�f|j|<qqWq
Wxy|jD]n}xetd�D]W}d|j|||j||t|j|�t|j|�|j||<q�Wq�Wtt	j
krA|jj|j�ndS(	NiR$R|iiiigY@(R�RR�R�R�R�RR�R�RuR8R?(RWR�RkR
((s/usr/share/dstat/dstat.pyR��s0MY(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR��s
						t
dstat_diskcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs>d|_d|_tjd�|_|jd�d|_dS(NR�twrittbs ^(dm-\d+|md\d+|[hsv]d[a-z]+\d+)$s/proc/diskstatsi(sreadR�(R�R�tretcompilet
diskfilterR�Rw(RW((s/usr/share/dstat/dstat.pyR]�s
		
cGs�g}x`|j�D]R}t|�dkr1qn|ddgdkrNqn|d}|j|�qWx|D]}|j|�qpW|s�td�n|S(Ni
it0iis*No suitable block devices found to monitor(R�RVRR�(RWR�R	R�RkR((s/usr/share/dstat/dstat.pyR~�s

cCs�g}tjrtj}nptjs-d}n^g}xK|jD]@}|jj|�r[q=n|t�krpq=n|j|�q=W|j�xA|D]9}||jdgtj	j
�kr�|j|�q�q�W|S(NR|(stotal(RuR9RR~R�tmatchtblockdevicesRRRRGRQ(RWR	R�Rk((s/usr/share/dstat/dstat.pyR�s"			

#cCs$g|jD]}dt|�^q
S(Nsdsk/(Rt	sysfs_dev(RWRk((s/usr/share/dstat/dstat.pyRk�sc
Cs�x|jD]}d|j|<q
Wx�|j�D]�}t|�dkrLq.n|ddkrr|ddkrrq.n|d}|ddgdkr�q.n|jj|�s�|jd	dt|d�|jd	d
t|d�f|jd	<n||jkrV|d	krV|j|dt|d�|j|d
t|d�f|j|<nx�|jD]�}|tjj	�kr`xztj|D]h}t
jd|d|�r�|j|dt|d�|j|d
t|d�f|j|<q�q�Wq`q`Wq.Wxn|jj	�D]]}|j|d|j|dd
t|j|d
|j|d
d
tf|j
|<qWttjkr�|jj|j�ndS(Nii
iR�i	iiiR|it^t$g�@(ii(RR�R�RVR�R�R�RuRGRQR�R�telapsedR�R�R8R?(RWRkR�RGR&((s/usr/share/dstat/dstat.pyR��s0 
HHW%6(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR��s
				tdstat_disk24cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs]d|_d|_tjd�|_|jd�|jrP|jrPtd�nd|_	dS(	NR�R�R�s(dm-\d+|md\d+|[hsv]d[a-z]+\d+)s/proc/partitionss,Kernel is not compiled with CONFIG_BLK_STATSi(sreadswrit(
R�R�R�R�R�R�R�R~R�Rw(RW((s/usr/share/dstat/dstat.pyR]	s		
cGs�g}xm|j�D]_}t|�dks|ddkst|d�ddkr[qn|d}|j|�qWx|D]}|j|�q}W|s�td�n|S(Niitmajoriiis*No suitable block devices found to monitor(R�RVR)RR�(RWR�R	R�RkR((s/usr/share/dstat/dstat.pyR~s<

cCs�g}tjrtj}n[tjs-d}nIg}x6|jD]+}|jj|�r[q=n|j|�q=W|j�xA|D]9}||jdgtjj	�kr}|j|�q}q}W|S(NR|(stotal(
RuR9RR~R�R�RRRRGRQ(RWR	R�Rk((s/usr/share/dstat/dstat.pyRs			

#cCs$g|jD]}dt|�^q
S(Nsdsk/(RR�(RWRk((s/usr/share/dstat/dstat.pyRk/sc
Csux|jD]}d
|j|<q
Wx�|j�D]�}t|�dks.|ddks.t|d�ddkrvq.n|d}|jj|�s�|jddt|d�|jddt|d	�f|jd<n||jkr1|j|dt|d�|j|dt|d	�f|j|<nx�|jD]�}|tj	j
�kr;xztj	|D]h}tjd
|d|�rd|j|dt|d�|j|dt|d	�f|j|<qdqdWq;q;Wq.Wxn|jj
�D]]}|j|d|j|ddt
|j|d|j|ddt
f|j|<q�Wttjkrq|jj|j�ndS(NiiR�iiiR|ii
R�R�g�@(ii(RR�R�RVR)R�R�R�RuRGRQR�R�R�R�R�R8R?(RWRkR�RGR&((s/usr/share/dstat/dstat.pyR�2s(<
HHW%6(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR�s
					tdstat_disk24oldcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsPd|_d|_tjd�|_tjd�|_|jd�d|_dS(	NR�R�R�s(dm-\d+|md\d+|[hsv]d[a-z]+\d+)s-^\((\d+),(\d+)\):\(\d+,\d+,(\d+),\d+,(\d+)\)$s
/proc/stati(sreadswrit(R�R�R�R�R�tregexpR�Rw(RW((s/usr/share/dstat/dstat.pyR]Js		
cGsg}x�|jd�D]�}t|�dkr4qn|d}|dkrPqnx�tj�dD]x}|jj|�}|s�qan|j�}t|�dkr�qantt|d�t|d��}|j	|�qaWPqWx|D]}|j	|�q�W|st
d�n|S(Nt:iitdisk_ioiis*No suitable block devices found to monitor(R�RVR�RLR�R�tgroupstdevR)RR�(RWR�R	R�RktpairtmR((s/usr/share/dstat/dstat.pyR~Rs,
#
cCs�g}tjrtj}n[tjs-d}nIg}x6|jD]+}|jj|�r[q=n|j|�q=W|j�xA|D]9}||jdgtjj	�kr}|j|�q}q}W|S(NR|(stotal(
RuR9RR~R�R�RRRRGRQ(RWR	R�Rk((s/usr/share/dstat/dstat.pyRes			

#cCsg|jD]}d|^q
S(Nsdsk/(R(RWRk((s/usr/share/dstat/dstat.pyRkwsc
Cs�x|jD]}d|j|<q
Wx/|jd�D]}t|�dkrOq1n|d}|dkrkq1nx�|j�dD]�}|jj|�}|s�q|n|j�}t|�dkr�q|ntt	|d�t	|d��}|j
j|�sA|jddt|d�|jddt|d�f|jd<n||jkr�|dkr�|j|dt|d�|j|dt|d�f|j|<nx�|jD]�}|tj
j�kr�xztj
|D]h}tjd	|d
|�r�|j|dt|d�|j|dt|d�f|j|<q�q�Wq�q�Wq|WPq1Wxn|jj�D]]}|j|d|j|ddt|j|d|j|ddtf|j|<qcWttjkr�|jj|j�ndS(
NiR�iR�iiR|iR�R�g�@(ii(RR�R�RVRLR�R�R�R�R)R�R�RuRGRQR�R�R�R�R�R8R?(RWRkR�R�R�R�RGR&((s/usr/share/dstat/dstat.pyR�zs>
#HHW%6(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR�Is
				tdstat_epochcBseZd�Zd�ZRS(cCs=d|_d|_d|_tjr0d|_nd|_dS(NR1i
i
i(sepoch(RkRR�RuRR�(RW((s/usr/share/dstat/dstat.pyR]�s				cCst|jd<dS(NR1(t	starttimeR�(RW((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyR��s		tdstat_fscBseZd�Zd�ZRS(cCs1d|_d|_d|_d|_d|_dS(NRtfilestinodesR�ii�(sfilesR�(RkRR�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s
				cCs�xOtd�D]A}|j�}t|�dkr7q
nt|d�|jd<q
Wx]td�D]O}|j�}t|�dkr�q_nt|d�t|d�|jd<q_WdS(Ns/proc/sys/fs/file-nriiR�s/proc/sys/fs/inode-nriR�(R�RLRVR�R�(RWR�R�((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyR��s	t	dstat_intcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsDd|_d|_d|_d|_|jd�|j�|_dS(Nt
interruptsR�ii�s
/proc/stat(RkR�R�R�R�tintmap(RW((s/usr/share/dstat/dstat.pyR]�s				
cCs�i}x�td�D]�}|j�}t|�tkr=qn|djd�d}dj|td�jd�}|||<x$|D]}|||j�j�<q�WqW|S(Ns/proc/interruptsiR�R�iR%(R�RLRVR�ROtstriptlower(RWR	R�R�tl1tl2Rk((s/usr/share/dstat/dstat.pyR��s 

cGs�g}xs|j�D]e}|ddkr/qnxFt|d�D]4\}}t|�dkr@|jt|��q@q@WqW|S(Nitintrii
(R�RR�RRJ(RWR�R	R�RkR
((s/usr/share/dstat/dstat.pyR~�sc
Cs�g}tjrtj}n_|j}x*|D]"}|dkr+|j|�q+q+Wtjrzt|�d	krz|d
}nxl|D]d}||jdgkr�|j|�q�|j�|jj	�kr�|j|j|j��q�q�W|S(
NR�t1t2t8tNMItLOCtMIStCPU0ii����R|(R�R�R�R�R�R�R�R�(
RuR:R~tremoveRRVRR�R�RQ(RWR	R�Rk((s/usr/share/dstat/dstat.pyR�s		


!cCs�x�|j�D]~}|s
|ddkr0q
nxA|jD]6}|dkr:t|t|�d�|j|<q:q:Wt|d�|jd<q
Wx8|jD]-}|j||j|dt|j|<q�Wtt	j
kr�|jj|j�ndS(NiR�R|iig�?(R�RR�R)R�R�R�R�R�RuR8R?(RWR�Rk((s/usr/share/dstat/dstat.pyR��s(+(RxRyR]R�R~RR�(((s/usr/share/dstat/dstat.pyR��s
				tdstat_int24cBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs5d|_d|_d|_d|_|jd�dS(NR�R�ii�s/proc/interrupts(RkR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s
				cCs�i}x�|j�D]�}t|�tkr1qn|djd�d}dj|td�jd�}|||<x$|D]}|||j�j�<qyWqW|S(NiR�R�iR%(R�RVR�RLROR�R�(RWR	R�R�R�Rk((s/usr/share/dstat/dstat.pyR�s 

cGszg}xm|j�D]_}t|�tdkr5qn|djd�d}t|d�dkr|j|�qqW|S(NiiR�i
(R�RVR�RLR�R(RWR�R	R�Rk((s/usr/share/dstat/dstat.pyR~
scCs�g}tjrtj}n_|j}x*|D]"}|dkr+|j|�q+q+Wtjrzt|�d
krz|d}nxe|D]]}||jkr�|j|�q�|j�|jj	�kr�|j|j|j��q�q�W|S(
NR�R�R�R�R�tERRR�R�R�ii����(	R�R�R�R�sCPU0R�sLOCsMISsNMI(
RuR:R~R�RRVRR�R�RQ(RWR	R�Rk((s/usr/share/dstat/dstat.pyRs		


!cCs
x�|j�D]�}t|�tdkr/q
n|djd�d}||jkr
d|j|<x:|ddt!D]$}|j|t|�|j|<qtWq
q
Wx>|jj�D]-}|j||j|dt	|j
|<q�Wttj
kr	|jj|j�ndS(NiiR�g�?(R�RVR�RLRR�R�RQR�R�R�R�RuR8R?(RWR�RkR
((s/usr/share/dstat/dstat.pyR�/s
)+(RxRyR]R�R~RR�(((s/usr/share/dstat/dstat.pyR��s
				tdstat_iocBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsPd	|_d|_d|_d|_tjd�|_|jd�d|_dS(
NR�R�R{ii�s(dm-\d+|md\d+|[hsv]d[a-z]+\d+)s/proc/diskstatsi(sreadswrit(	R�R�R�R�R�R�R�R�Rw(RW((s/usr/share/dstat/dstat.pyR]As				
cGs�g}x`|j�D]R}t|�dkr1qn|ddgdkrNqn|d}|j|�qWx|D]}|j|�qpW|s�td�n|S(Ni
iR�iis*No suitable block devices found to monitor(R�RVRR�(RWR�R	R�RkR((s/usr/share/dstat/dstat.pyR~Js

cCs�g}tjrtj}nptjs-d}n^g}xK|jD]@}|jj|�r[q=n|t�krpq=n|j|�q=W|j�xA|D]9}||jdgtj	j
�kr�|j|�q�q�W|S(NR|(stotal(RuR9RR~R�R�R�RRRRGRQ(RWR	R�Rk((s/usr/share/dstat/dstat.pyRVs"			

#cCsg|jD]}d|^q
S(Nsio/(R(RWRk((s/usr/share/dstat/dstat.pyRkisc
Cs�x|jD]}d
|j|<q
Wx�|j�D]�}t|�dkrLq.n|ddkrr|ddkrrq.n|d}|ddgdkr�q.n|jj|�s�|jddt|d�|jdd	t|d�f|jd<n||jkrV|dkrV|j|dt|d�|j|d	t|d�f|j|<nx�|jD]�}|tjj	�kr`xztj|D]h}t
jd
|d|�r�|j|dt|d�|j|d	t|d�f|j|<q�q�Wq`q`Wq.Wxn|jj	�D]]}|j|d|j|ddt|j|d	|j|d	dtf|j
|<qWttjkr�|jj|j�ndS(Nii
iR�iiiR|iR�R�g�?(ii(RR�R�RVR�R�R�RuRGRQR�R�R�R�R�R8R?(RWRkR�RGR&((s/usr/share/dstat/dstat.pyR�ls0 
HHW%6(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR�@s
					t	dstat_ipccBseZd�Zd�ZRS(cCs1d|_d|_d|_d|_d|_dS(	Nssysv ipctmsgtsemtshmR�ii
(smsgRR(RkRR�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s
				cCs?x8|jD]-}ttd|�j��d|j|<q
WdS(Ns/proc/sysvipc/i(RRVR�R�R�(RWRk((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyR��s	t
dstat_loadcBseZd�Zd�ZRS(cCsGd|_d|_d
|_d|_d	|_d
|_|jd�dS(Nsload avgt1mt5mt15mtload1tload5tload15R{ig�?s
/proc/loadavg(RRR(RRR	(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s						cCsxxq|j�D]c}t|�dkr+q
nt|d�|jd<t|d�|jd<t|d�|jd<q
WdS(NiiRiRiR	(R�RVRR�(RWR�((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyR�s		t
dstat_lockcBseZd�Zd�ZRS(cCsGd|_d|_d|_d
|_d|_d|_|jd
�dS(Ns
file lockstpostlcktreatwritposixtflockR�twriteR{ii
s/proc/locks(sposRR
R(sposixRsreadswrite(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s						cCs�x|jD]}d|j|<q
Wx�|j�D]�}t|�dkrLq.n|ddkrr|jdcd7<n&|ddkr�|jdcd7<n|dd	kr�|jd
cd7<q.|ddkr.|jdcd7<q.q.WdS(
NiiitPOSIXRtFLOCKRitREADR�tWRITER(RR�R�RV(RWRkR�((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyR
�s		t	dstat_memcBseZd�Zd�ZRS(cCs,d|_d|_d|_|jd
�dS(
Nsmemory usagetusedtbufftcachtfreetMemUsedtBufferstCachedtMemFrees
/proc/meminfo(RRRR(RRRR(RkR�RR�(RW((s/usr/share/dstat/dstat.pyR]�s			cCs�xt|j�D]f}t|�dkr+q
n|djd�d}||jdkr
t|d�d|j|<q
q
W|jd|jd|jd|jd	|jd
<dS(NiiR�tMemTotalig�@RRRR(R(R�RVRLRR�R�(RWR�Rk((s/usr/share/dstat/dstat.pyR��s"(RxRyR]R�(((s/usr/share/dstat/dstat.pyR�s	t	dstat_netcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs>d|_d|_tjd�|_|jd�d|_dS(NtrecvtsendR�s^(lo|bond\d+|face|.+\.\d+)$s
/proc/net/devi(R!ssend(R�R�R�R�ttotalfilterR�Rw(RW((s/usr/share/dstat/dstat.pyR]�s
		
cGs�g}x~|jdd�D]j}t|�dkr7qn|ddkr]|ddkr]qn|d}|d
kr|j|�qqW|j�x|D]}|j|�q�W|S(NR�R�iiR�i
itlotface(sloR%(R�RVRRR(RWR�R	R�RkR((s/usr/share/dstat/dstat.pyR~�s 


cCs�g}tjrtj}n%tjs-d}n|j}|j�x7|D]/}||jddgkrG|j|�qGqGW|s�td�n|S(NR|R$s/No suitable network interfaces found to monitor(stotal(RuR;RR~RRRR�(RWR	R�Rk((s/usr/share/dstat/dstat.pyR�s				

cCsg|jD]}d|^q
S(Nsnet/(R(RWRk((s/usr/share/dstat/dstat.pyRk�scCsddg|jd<x�|jdd�D]�}t|�dkrDq&n|ddkrj|ddkrjq&n|d}||jkr�t|d	�t|d
�f|j|<n|jj|�s&|jddt|d	�|jdd	t|d
�f|jd<q&q&Wtr�x�|jj�D]�}|j|d|j	|ddt
|j|d	|j	|d	dt
g|j|<|j|ddkr�|j|dctd	7<n|j|d	dkr!|j|d	ctd	7<q!q!Wnt
tjkr|j	j|j�ndS(NiR|R�R�iiR�i
ii	g�?(R�R�RVRR�R#R�R?RQR�R�R�tmaxintR�RuR8(RWR�Rk((s/usr/share/dstat/dstat.pyR��s* 
*L%2%(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyR �s
				t
dstat_pagecBseZd�Zd�ZRS(cCs5d|_d|_d	|_d|_|jd�dS(
NtpagingtintouttpswpintpswpoutR�s/proc/vmstat(sinsout(R+R,(RkR�RR�R�(RW((s/usr/share/dstat/dstat.pyR]s
				cCs�x_|j�D]Q}t|�dkr+q
n|d}||jkr
t|d�|j|<q
q
Wx<|jD]1}|j||j|tdt|j|<qlWt	t
jkr�|jj|j�ndS(Niiig�?(
R�RVRR�R�R�tpagesizeR�R�R�RuR8R?(RWR�Rk((s/usr/share/dstat/dstat.pyR�s
/(RxRyR]R�(((s/usr/share/dstat/dstat.pyR's	tdstat_page24cBseZd�Zd�ZRS(cCs5d|_d|_d	|_d|_|jd�dS(
NR(R)R*R+R,R�s
/proc/stat(sinsout(spswpinspswpout(RkR�RR�R�(RW((s/usr/share/dstat/dstat.pyR]s
				cCs�xw|j�D]i}t|�dkr+q
n|d}|dkrGq
nt|d�|jd<t|d�|jd<Pq
Wx<|jD]1}|j||j|tdt|j|<q�Wt	t
jkr�|jj|j�ndS(	NiiR/iR+iR,g�?(
R�RVR�R�RR�R-R�R�R�RuR8R?(RWR�Rk((s/usr/share/dstat/dstat.pyR�s
/(RxRyR]R�(((s/usr/share/dstat/dstat.pyR.s	t
dstat_proccBseZd�Zd�ZRS(cCsGd|_d|_d
|_d|_d	|_d
|_|jd�dS(Ntprocstruntblktnewt
procs_runningt
procs_blockedt	processesR{ii
s
/proc/stat(srunR2snew(R4R5R6(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR])s						cCsmx�|j�D]�}t|�dkr+q
n|d}|dkrhd|jd<t|d�|j|<q
|dkr�|j|t|d�d|j|<q
|dkr
|j|t|d�|j|<q
q
W|jd|jddt|jd<x*dD]"}|j|dt|j|<qWttj	kri|jj
|j�xd	D]}d|j|<qOWndS(
NiiR6iR4R5g�?(s
procs_runnings
procs_blocked(s
procs_runnings
procs_blocked(R�RVR�R�R�R�R�R�RuR8R?(RWR�Rk((s/usr/share/dstat/dstat.pyR�2s$

))'
 
(RxRyR]R�(((s/usr/share/dstat/dstat.pyR/(s		t	dstat_rawcBseZd�Zd�ZRS(cCsGd|_d|_d|_d|_d|_d|_|jd�dS(	NtrawtsocketsR�iids
/proc/net/raw(R8(R9(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]Fs						cCs8d}x|j�D]}|d7}qW||jd<dS(Ni����iR9(R�R�(RWtlinesR�((s/usr/share/dstat/dstat.pyR�Os(RxRyR]R�(((s/usr/share/dstat/dstat.pyR7Es		tdstat_socketcBseZd�Zd�ZRS(cCsGd|_d|_d|_d|_|jd�d|_d|_dS(NR9R�iids/proc/net/sockstatttotttcptudpR8tfrgssockets:sTCP:sUDP:sRAW:sFRAG:(R<R=R>srawR?(ssockets:sTCP:sUDP:sRAW:sFRAG:(RkR�R�R�R�R�R(RW((s/usr/share/dstat/dstat.pyR]Xs				
	cCs�xG|j�D]9}t|�dkr+q
nt|d�|j|d<q
W|jd|jd|jd|jd|jd|jd	<dS(
Niiissockets:sTCP:sUDP:sRAW:sFRAG:tother(R�RVR�R�(RWR�((s/usr/share/dstat/dstat.pyR�as
(RxRyR]R�(((s/usr/share/dstat/dstat.pyR;Ws		t
dstat_swapcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs,d|_d|_d|_|jd�dS(NR/RRR�s/proc/swaps(susedsfree(RkR�R�R�(RW((s/usr/share/dstat/dstat.pyR]hs			cGs�g}x�|j�D]r}t|�dkr1qn|ddkrGqny t|d�t|d�Wn
qnX|j|d�qW|j�x|D]}|j|�q�W|S(NiitFilenameii(R�RVR)RRR(RWR�R	R�R((s/usr/share/dstat/dstat.pyR~ns 

cCs�g}tjrtj}n%tjs-d}n|j}|j�x4|D],}||jdgkrG|j|�qGqGW|s�td�n|S(NR|s)No suitable swap devices found to monitor(stotal(RuR<RR~RRRR�(RWR	R�Rk((s/usr/share/dstat/dstat.pyR~s				

cCs$g|jD]}dt|�^q
S(Nsswp/(Rtimprove(RWRk((s/usr/share/dstat/dstat.pyRk�scCs�ddg|jd<x�|j�D]�}t|�dks |ddkrNq n|d}t|d�dt|d�t|d�df|j|<|jdd|j|d|jdd|j|df|jd<q WdS(	NiR|iRBig�@ii(R�R�RVR�(RWR�Rk((s/usr/share/dstat/dstat.pyR��s"
=(RxRyR]R~RRkR�(((s/usr/share/dstat/dstat.pyRAgs
				t
dstat_swapoldcBseZd�Zd�ZRS(cCs5d|_d|_d	|_d|_|jd�dS(
NR/RRtSwapUsedtSwapFreeR�s
/proc/meminfo(susedsfree(RERF(RkR�RR�R�(RW((s/usr/share/dstat/dstat.pyR]�s
				cCs�xt|j�D]f}t|�dkr+q
n|djd�d}||jd	kr
t|d�d|j|<q
q
W|jd|jd|jd<dS(
NiiR�t	SwapTotalig�@RFRE(RG(R�RVRLRR�R�(RWR�Rk((s/usr/share/dstat/dstat.pyR��s"(RxRyR]R�(((s/usr/share/dstat/dstat.pyRD�s	t	dstat_syscBseZd�Zd�ZRS(cCsGd|_d
|_d|_d|_d|_d|_|jd	�dS(NtsystemR)tcswR�tctxtR�ii�s
/proc/stat(sintRJ(sintrRK(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s						cCs�x_|j�D]Q}t|�dkr+q
n|d}||jkr
t|d�|j|<q
q
Wx8|jD]-}|j||j|dt|j|<qlWtt	j
kr�|jj|j�ndS(Niiig�?(R�RVRR�R�R�R�R�R�RuR8R?(RWR�Rk((s/usr/share/dstat/dstat.pyR��s
+(RxRyR]R�(((s/usr/share/dstat/dstat.pyRH�s		t	dstat_tcpcBseZd�Zd�ZRS(cCsJd|_d|_d|_d|_d|_d
|_|jdd�dS(Nstcp socketstlistacttsynttimtclotlistentestablishedtwaittcloseR�iids
/proc/net/tcps/proc/net/tcp6(RMRNRORPRQ(RRRSROswaitsclose(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s						cCsx|jD]}d|j|<q
Wx�|j�D]�}t|�dkrLq.n|ddkrr|jdcd7<q.|ddkr�|jdcd7<q.|ddkr�|jdcd7<q.|ddkr�|jdcd7<q.|ddkr.|jdcd7<q.q.WdS(Niiit0ARRit01RSt02t03t09ROt06RTt04t05t07t08t0BRU(RV(RW(RXRYRZ(R[(R\R]R^R_R`(RR�R�RV(RWRkR�((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyRL�s		t
dstat_timecBseZd�Zd�ZRS(cCs�d|_tjd�pd|_d|_tjr^ttj	|jtj
���d|_n$ttj	|jtj
���|_d|_d|_
dS(	NRIt
DSTAT_TIMEFMTs%d-%m %H:%M:%StsiiR0(stime(RkR_RottimefmtR�RuRRVR0tstrftimet	localtimeR�R�R(RW((s/usr/share/dstat/dstat.pyR]�s			+$	cCsptjrGtj|jtjt��dttdd�|jd<n%tj|jtjt��|jd<dS(Ns.%03di�R0(	RuRR0ReRdRfR�R�R�(RW((s/usr/share/dstat/dstat.pyR��s	>(RxRyR]R�(((s/usr/share/dstat/dstat.pyRa�s	t	dstat_udpcBseZd�Zd�ZRS(cCsJd|_d|_d|_d|_d|_d|_|jd	d
�dS(
NR>RMRNRRRSR�iids
/proc/net/udps/proc/net/udp6(slissact(slistensestablished(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s						cCs�x|jD]}d|j|<q
Wx`|j�D]R}|ddkrZ|jdcd7<q.|ddkr.|jdcd7<q.q.WdS(NiiR^RRiRWRS(RR�R�(RWRkR�((s/usr/share/dstat/dstat.pyR��s(RxRyR]R�(((s/usr/share/dstat/dstat.pyRg�s		t
dstat_unixcBseZd�Zd�ZRS(cCsGd|_d|_d|_d
|_d|_d|_|jd
�dS(Nsunix socketstdgmRJRMRNtdatagramtstreamRRRSR�iids/proc/net/unix(Risstrslissact(Rjsstreamslistensestablished(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]�s						cCs�x|jD]}d|j|<q
Wx�|j�D]�}|ddkrZ|jdcd7<q.|ddkr.|jdcd7<|dd	kr�|jd
cd7<q�|ddkr�|jdcd7<q�q.q.WdS(
Niit0002Rjit0001RkiRWRRRYRS(RR�R�(RWRkR�((s/usr/share/dstat/dstat.pyR�s(RxRyR]R�(((s/usr/share/dstat/dstat.pyRh�s		tdstat_vmcBseZd�Zd�ZRS(cCsGd|_d|_d|_d
|_d|_d|_|jd
�dS(Nsvirtual memorytmajpftminpftallocRt
pgmajfaulttpgfaulttpgalloctpgfreeR�ii�s/proc/vmstat(RoRpRqsfree(RrRsRtRu(RkR�RR�R�R�R�(RW((s/usr/share/dstat/dstat.pyR]
s						cCsd|jd<x�|j�D]�}t|�dkr8qn|djd�rk|jdct|d�7<q|d|jkrt|d�|j|d<qqWx8|jD]-}|j||j|dt|j|<q�Wt	t
jkr|jj|j�ndS(NiRtitpgalloc_ig�?(
R�R�RVRUR�RR�R�R�R�RuR8R?(RWR�Rk((s/usr/share/dstat/dstat.pyR�s
 "+(RxRyR]R�(((s/usr/share/dstat/dstat.pyRns	stblackstdarkredst	darkgreenst
darkyellowstdarkbluestdarkmagentastdarkcyanstgraystdarkgraystredstgreenstyellowstbluestmagentastcyanstwhitestblackbgstredbgstgreenbgstyellowbgstbluebgst	magentabgstcyanbgstwhitebgstresetstboldstreversest	underlinestclearst	clearlines7tsaves8trestorestlinewrapst
nolinewrapstupstdownstrightstleftt|R�R�R�t>R�R�R�R�R�t+tplust_t
underscorec
Cs@tjr$itdd6tdtdd6tdd6tdd6tdtd	d
6tdd6tdd
6tdd6tdd6tdd6tdd6tdd6tdtdtdtdtdtdtdtdfd6tdtdtdtdtdtdtdtdfd6}nitdd6tdtdd6tdd6tdd6tdtd	d
6tdd6tdd
6tdd6tdd6tdd6tdd6tdd6tdtdtdtdtdtdtdtdfd6tdtd tdtdtdtdtdtdfd6}|S(!sProvide a set of colors to useR{R�R}R�R�R�RR�R�RIt	roundtripRxRRtinputRwttext_lottext_hitunit_lotunit_hiR|RyR~R�R�t	colors_loR�R�R�t	colors_hiR�Rz(RuRtansi(R�((s/usr/share/dstat/dstat.pyt	set_themedsH	#)#&cCs�yVxOtddd�j�D]5}|j�}t|�dkrFqnt|d�SWWnpxjtd�j�D]R}|j�}t|�dkr�qon|ddkrotj�t|d�SqoWnXdS(	s)Return the number of 'ticks' since bootups/proc/uptimetriis
/proc/stattbtimeiN(R�R�RLRVRR�R0R�(R�R�((s/usr/share/dstat/dstat.pytticks�scCsN|jd�r%|jd�d}n%|jd�rJ|jd�d}n|S(sImprove a device names/dev/mapper/R^is/dev/i(RURL(tdevname((s/usr/share/dstat/dstat.pyRC�s
cCs�tjj|�s"td|�ndt�j�kr@ianttj�krkt|dd�t|<nt|j	d�t|S(s@Open a file for reuse, if already opened, return file descriptorsFile %s does not existtfdsR�i(
R_R`RaR�tglobalsRQR�R�R�R�(R�((s/usr/share/dstat/dstat.pyR��s	cCsFdt�j�krian|tkrBt|j�t|=ndS(s7Close an open file and remove file descriptor from listR�N(R�RQR�RU(R�((s/usr/share/dstat/dstat.pytdclose�s
	cCs`ddladt�j�kr*ian|tj�krXtj|dd�t|<nt|S(s6Open a pipe for reuse, if already opened, return pipesi����Ntpipestti(tselectR�RQR�R_tpopen3(tcmd((s/usr/share/dstat/dstat.pytdpopen�s	g����MbP?cCs~d}x)tj|j�ggg|�ds1q	Wx<tj|j�ggg|�drp||jd�}q5W|jd�S(s7Read available data from pipe in a non-blocking fashionRiis
(R�tfilenoR�RL(tfileobjttmoutR	((s/usr/share/dstat/dstat.pytreadpipe�s((cCs�d}x)tj|j�ggg|�ds1q	Wxjtj|j�ggg|�dr�|jd�}|dkr�||}q5|j|�r�|Sd}q5Wtjr�td�ndS(s7Grep available data from pipe in a non-blocking fashionRiis
s-Nothing found during greppipe data collectionN(R�R�R�RURuRR�R6(R�RJR�R	t	character((s/usr/share/dstat/dstat.pytgreppipe�s((

	cCs�d}tj|�}x)tj|j�ggg|�ds@qWxjtj|j�ggg|�dr�|jd�}|dkr�||}qD|j|�r�|Sd}qDWtjr�td�ndS(s8Match available data from pipe in a non-blocking fashionRiis
s.Nothing found during matchpipe data collectionN(
R�R�R�R�R�R�RuRR�R6(R�tstringR�R	R�R�((s/usr/share/dstat/dstat.pyt	matchpipe�s((

	cCsCtj|dd�}x'|dj�D]}t|j��q&WdS(NR�ii(R_R�R�R�R�(R�R�R�((s/usr/share/dstat/dstat.pytcmd_test�sccs9tj|dd�}x|dj�D]}|Vq&WdS(NR�ii(R_R�R�(R�R�R�((s/usr/share/dstat/dstat.pyt
cmd_readlines�sccsBtj|dd�}x&|dj�D]}|j|�Vq&WdS(NR�ii(R_R�R�RL(R�R�R�R�((s/usr/share/dstat/dstat.pytcmd_splitlines�sccsBd}x5tr=tj||�}|s+Pn|V|d7}q	WdS(s&Return the lines of a file, one by oneiN(R=t	linecachetgetline(R�R
R�((s/usr/share/dstat/dstat.pytproc_readlines�s	ccsKd}x>trFtj||�}|s+Pn|j|�V|d7}q	WdS(s/Return the splitted lines of a file, one by oneiN(R=R�R�RL(R�R�R
R�((s/usr/share/dstat/dstat.pytproc_splitliness	cCstj|d�S(sReturn the first line of a filei(R�R�(R�((s/usr/share/dstat/dstat.pyt
proc_readlinescCstj|d�j|�S(s(Return the first line of a file splittedi(R�R�RL(R�R�((s/usr/share/dstat/dstat.pytproc_splitlinesccslttj��}xStjd�D]B}y%t|�||krGw"n|VWq"tk
rcq"q"Xq"WdS(sReturn a list of process IDss/proc/N(RJR_tgetpidtlistdirR)t
ValueError(t	dstat_pidtpid((s/usr/share/dstat/dstat.pytproc_pidlist#s
	
cCsed}xRtrTttt|���}t|�|kr=Pn||}|d}q	Wd}||fS(s/Convert decimal to string given base and lengthiii����(R=RJR�R�RV(R�R�tbasetcR	((s/usr/share/dstat/dstat.pytdchg3s	
cCsd}x�tr|dkr+td�}Pnttt||���}t|�|kr�|t|�d}xw|dkr�d||}t|�|kr�|ttt||���kr�Pn|d}qoWttt|���}Pn||}|d}q	Wd}||fS(s.Convert float to string given scale and lengthiR�is%%.%dfi����(R=RJR�R�RV(R�R�R�R�R	R
((s/usr/share/dstat/dstat.pytfchg@s&	3
cCs�d|d|df}t|�|kr�d|d}t|�|kr�d|dd}t|�|kr�d|ddd}q�q�n|S(s#Convert time string to given lengths%2dh%02di<s%2dhs%2ddis%2dwi(RV(R�R�R	((s/usr/share/dstat/dstat.pyttchgZscCsFd}}x5|D]-}||t||||�}td}qW|S(s Return all columns color printedRR�(R�R�(R�R�R�R�R	R�R�((s/usr/share/dstat/dstat.pyR�es


R{ii�c
Cs�d}|dkrd}nt}|d"krX|tt|��krXt}|d}n|dkr�|r�tddj|td�tdtdStddj|td�tdSn|dkr�tdd	d
ddd
dddf	}n8tjr#|d#kr#d$}d}}|d}nd%}t	tj
krYtd}td}td}	ntd}td}td}	tjr�|d&kr�t|||�\}
}n�tj
r�|d'kr�t|||�\}
}n�|d(kr�t|||�\}
}n{|dkr%t|||�\}
}nT|dkrGt|�|}
}n2|dkrlt||�|}
}n
td|�|
d kr�|	}n�|dkr�|}n�|d)kr�|t||�t|�}n\|dkr|tt|�|�t|�}n)|d*kr&||t|�}n|}|d+krU||
j|td�}
n||
j|td�}
|r�|d!kr�t|�dkr�|
|	||7}
q�|
td7}
n|
S(,sColor print one columni�iiiRIR�R�RtktMtGtTtPtEtZtYR�g @tBR�R�R�R�R�R�R�R�R{RcR�sType %s not known to dstat.R�i����(i�i(R�(	R�R�R�R�R�R�R�R�R�(	R�R�R�R�R�R�R�R�R�(R�R�R�R{(R�R�R�R{(R�R�R�(i�i(R�R�R{(Rc(R4RVRJR=R�trjustR�RuRR�R8RR�RR�R�R�R)R�tljust(
R�R�R�R�R�tunittunitstcolorstctexttcunitR	R�R>((s/usr/share/dstat/dstat.pyR�msr	$
,'(








		!'cCs�d}xl|D]d}||j�7}||dk	rL|tdtd7}q
||kr
|tdtd7}q
q
W|d7}xl|D]d}||j�7}||dk	r�|tdtd7}q�||kr�|tdtd7}q�q�W|dS(	s.Return the header for a set of module countersRi����R�R�R�R�s
R�(R�R�R�R�(R�R�R�to((s/usr/share/dstat/dstat.pyR@�s


cCs�d}x;|D]3}||j�}||dk	r
|d}q
q
W|d7}x;|D]3}||j�}||dk	rU|d}qUqUW|dS(s2Return the CVS header for a set of module countersRi����R%s
(R�R�(R�R�R�((s/usr/share/dstat/dstat.pyt	csvheader�s


cCstj|IJdS(sOutput info messageN(R2RN(tlevelRJ((s/usr/share/dstat/dstat.pytinfo�scCstj|IJt|�dS(s#Print error and exit with errorcodeN(R2RNRK(R	RJ((s/usr/share/dstat/dstat.pytdie�s
cCs}y/ddladdladdlatjWnAy*tj�tjd�tjd�fWnqyXdanXdadS(	sInitialise terminali����NR:Rwii(Ni(Ni(	tfcntltstructttermiost
TIOCGWINSZtcursest	setuptermttigetnumR6ttermsize(((s/usr/share/dstat/dstat.pytinitterm�s$
 
cCs�tds�y�tddkrmtjddddd�}tjtjj�tj	|�}tj
d|�d Stddkr�tj�tj
d�tj
d�fSttjd�ttjd�faWq�daq�XntS(s$Return the dynamic terminal geometryiitHHHHiR:RwtLINEStCOLUMNSiiP(iiP(R�R�tpackR�tioctlR2RER�R�R�tunpackR�R�R�R)R_tenviron(Rctx((s/usr/share/dstat/dstat.pyRps
!
*
cCsg|rctjj�rcy3ddl}|j�|jd�dkrGtSWqctjdIJtSXn|S(s/Return whether the system can use colors or noti����NR�is:Color support is disabled, python-curses is not installed.(R2RERFR�R�R�R4RN(R>R�((s/usr/share/dstat/dstat.pyRns

cCs$|ddkr tjj|�S|S(sPerform basename on paths onlyiR^t.(R^R�(R_R`tbasename(Rk((s/usr/share/dstat/dstat.pyR�&scCs�d}y�tjd|d�jd�}t|d�}|dkrWt|d�}n|jd�r�t|d
�}|jd�r��q�n|s��nWnt|�}nX|S(sAReturn the name of a process by taking best guesses and exclusions/proc/%s/cmdlineititbashtcshtkshtperltpythontrubytshR�i����N(R�RRRspythonRR(R6R�R�RLR�RU(R�RkR	tcmdline((s/usr/share/dstat/dstat.pytgetnamebypid,s	
cCs_d}x:td�j�D]&}|dd!dkr|d}qqW|dkr[td�n|S(s'Return the number of CPUs in the systemi����s
/proc/statiiR$is)Problem finding number of CPUs in system.(R�R�R�(R�R�((s/usr/share/dstat/dstat.pyRq=scCs8gtjd�D]$}tjj|�jdd�^qS(Ns/sys/block/*t!R^(tglobR_R`R�R�(R�((s/usr/share/dstat/dstat.pyR�GscCs�tjd|�}|r^|j�}t|d�dt|d�}dttd�|�Stjd|�}|r�|j�}|dStjd	|�}|r�d
S|S(s,Convert sysfs device names into device namess,ide/host(\d)/bus(\d)/target(\d)/lun(\d)/disciiithdtascciss/(c\dd\d)itplaceholdertsdX(R�R�R�R)tchrtord(tdeviceR�R�tnr((s/usr/share/dstat/dstat.pyR�Ls"cCs�dg}dddddddd	d
dg
}dg}d
dddddddddddddddg}dg}ddd d!d"d#d$d%g}d&g}d'g}	d(g}
||krttd)�|j|�d*|d*�}|d*}|s�d+|Sd,||fS||krhttd)�|j|�d-|d.�}|d.}|sZd/|Sd0||fS||
kr|d1|S||kr�d2|S||kr�d3|S||kr�d4|S||	kr|	j|�d*|d*}|d*}|s�d5|Sd6||fS||krY|j|�}
|d*}|d*}|sHd7|
|fSd8|
||fS||kr�|j|�d*|d*}|d*}|s�d9|Sd:||fSd;||fSd<S(=s+Convert major/minor pairs into device namesiiii!i"i8i9iXiYiZi[iiiAiBiCiDiEiFiGi�i�i�i�i�i�i�i�i	iHiIiJiKiLiMiNiOibihi�Rissd%sssd%s%dii@shd%sshd%s%dsdm-%dsmd%dsloop%dsram%dsc0d%dsc0d%dp%dsida%d-%dsida%d-%d-%dsubd%dsubd%d-%dsdev%d-%dN(RRR(tmajtmintramtidetlooptscsitmdtidatubdtccisstdmtdisctparttcont((s/usr/share/dstat/dstat.pyR�^sb	$	6				+
+




cCs�g}tjd�}xCt�D]8}|jd�r|j|j|�j�d�qqWtjd�}xXtD]P}xGtj|d�D]2}|j|j|�j�dj	dd��q�WqqW|j
�|S(Nsdstat_(.+)$tdstat_is.+/dstat_(.+).py$s/dstat_*.pyR�R�(R�R�R�RURR�R�t
pluginpathR	R�RR(RDtremodR�R`((s/usr/share/dstat/dstat.pyRC�s'
4
cCst�\}}dGtjd�}g}xOt�D]D}|jd�r2|j|j|�j�djdd��q2q2W|j	�|d}xd|D]\}|t
|�d}|dkr�d	G|t
|�d
}n||dkr�|dGq�q�W|GHtjd
�}x�tD]�}g}xGtj|d�D]2}|j|j|�j�djdd��q0W|srqn|j	�|d}dt
jj|�Gxd|D]\}|t
|�d}|dkr�d	G|t
|�d
}n||dkr�|dGq�q�W|GHqWdS(Nsinternal:
	sdstat_(.+)$R iR�R�iis
	i
i����R%s.+/dstat_(.+).py$s/dstat_*.pys%s:
	(RpR�R�R�RURR�R�R�RRRVR!R	R_R`tabspath(RvRwR"RDR�tcols2tmodR`((s/usr/share/dstat/dstat.pyRS�sF3



0


cCs�tjjtd�tjj�tjrRtjj	tj�rRtj
tj�ntjr�tjj	tj�r�t�\}}ddl
}|jtj�}|jd�j|d�ntjr�tjdIJntj|�dS(NR�i����t
cumulativei
s=No profiling data was found, maybe profiler was interrupted ?(R2RERR�tflushRuRBR_R`RaR�R!RptpstatstStatst
sort_statstprint_statsRNRK(R	RvRwR(R�((s/usr/share/dstat/dstat.pyRK�s
	c	Bs�e�aejd�aejddaeej��a	e
j�ad}e
j�}ej�d}ejjd�ejj�rejd�}ejd�}|dkr|rejd�j|�rejjd	||ejjejd
�djej�f�qneej�e_ejr�ejj ej�rje!ejdd
�a"t"jd
�n3e!ejdd
�a"t"jde#�t"jd�t"jd||f�t"jddjej�e$j%de$j&��f�nej'rmy<e!ej'dd
�}|jeej���|j(�Wqme)k
ri}ej*dej'I|IJe+e_'qmXnejs�e+e_,xt-j.�D]}dt-|<q�Wxt/j.�D]}dt/|<q�Wt-dft/d<t-dft/d<nej,s�ej0}nd
}ga1x�ej2D]�}	|	dkr,d:}
n]|	dkrAd;}
nH|	dkrVd<}
n3|	d krkd=}
n|	d"kr�d>}
n	|	f}
x	|
D]}d$|j3d%d&�}y�|e4�j.�kr�d'd(l5}
|
j6|e7�\}}}|j(�|d
d?kr7e8|�d*d(U|e9_:e9j;�e9j<�q�|d
d+krvd,|d(Ud-|d(Ue9j;�e9j<�q�ej*d.|IJn d/|d(Ue9j;�e9j<�Wn�e)k
r%}||
d'kr�ej*d0||fIJn#ej=r
ej*d1||fIJnej=d2kr��q�q�nej*d3|IJnX|e9j>�d}t1j?e9�ej=r�d4G|Ge@e9d5�r�d6Ge9jAGnHnPq�WqWt1s�eBd7d8�nejr�t"jeCt1��neDjEe$j$e$jF�}e$j$�aGd
a,d
aHxqt,ej0ejIks&ejId'krq|jJtGt,deKt,f�|jL�ejjM�t,|a,eNjO�qWej,r�ejjd9�nd(S(@s<Initialization of the program, terminal, internal structuresRiiistXTERM_SHELLRhs	/bin/bashs(screen*|xterm*)s]0;(%s@%s) %s %siR�Rs

tws"Dstat %s CSV output"
s["Author:","Dag Wieers <dag@wieers.com>",,,,"URL:","http://dag.wieers.com/home-made/dstat/"
s"Host:","%s",,,,"User:","%s"
s'"Cmdline:","dstat %s",,,,"Date:","%s"

s%d %b %Y %H:%M:%S %ZsFailed to create pidfile %sRRR�R�R$tcpu24R&tdisk24t	disk24oldR)tint24R(tpage24R/tswapoldR R�R�i����Ns.pys%o = dstat_plugin(); del(dstat_plugin)s.sos	import %sso = %s.new()sModule %s is of unknown type.so = %s()sModule %s failed to load. (%s)s.Module %s failed to load, trying another. (%s)is"Module %s caused unknown exceptiontModuleR�trequiresis-None of the stats you selected are available.s
(scpuR.(sdiskR/R0(sintR1(spageR2(sswapR3(s.py(PRqR�R_RtthzR2R&RJR�townpidRrRsR-tgetpasstgetuserRmRERRFRoR�R�R�R`R�targvRORuR3RnR>RARaR�t
outputfileRjR0ReRfRBRUR�RNR4R?R�RQR�R8R�RDR�R�timptfind_moduleR!texecfileR�R�R�R�RR�RR�R�R�R�tschedt	schedulertsleeptinittimetmissedR5tenterabstperformR1R'R�t
clearcache(tintervaltuserthostnametshellttermRBtetkeyt	linewidthtpluginRR%t
pluginfileR<tfptpathnametdescriptionR@((s/usr/share/dstat/dstat.pytmain�s�	*E	
8										


	




	
			(


	cCstj�a|dtjtja|dtjdatjsKd}n'tdksctdkrldand}tdkr�tt|dkr�t	da	dStdkr�t
�ad\aa
gagatantatjj�r�t
}t�\aa
|t
krxgaxctD]X}||j�d}|t
ks[ttd kr|t
krtj|�|}qqWntjr�tdkr�ttkr�taq�tdkr�ttddkr�taq�ntantattjkr�tdtd<ntdtd<d	}tjrotdkrS|dkrSd
tdtdtd}qotdkrotd
}qontr�tdkr�ttkr�tjdIJntatjj|�ttt�}n|}d	}x�tD]z}|j �|tkr||j!�|j"tt�}ntj#r�ttjkr�||j$�|j%tt�}q�q�Wtjj|td�tj#r�ttjkr�t&j|d
�ntjr�ttj�tdatdkr�ttantjdkrtjjdtdtttdf�q�tjdkrWtjjdtdtttdtttdf�q�tjdkr�tjjdtdtttdtt|tdf�q�nt	dkr�tjjdtddt't	d�dtd�da	ntjstjjd
�ndS(s9Inner loop that calculates counters and constructs outputiiii����iR�RR�Rs
R�R�R�s*Terminal width too small, trimming output.R�g@�@s%s%6.2fms%sR�is%s%6.2f %s%d:%d%sRs%s%6.2f %s%d:%d:%d%sR�RIsmissed s ticksN(ii((R0R�RuR8RR�Rt	totaltimeRBRCR�R�RvRwR�t
oldvislistR=t
showheaderR2RERFRpR�R�RR@R�R�R?RNR4RR�R�R�RAR�R�R;RJ(R?tcurwidthtoldcolsR�tnewwidthtnewlineR�toline((s/usr/share/dstat/dstat.pyRE�	s�			 
		
(
	 		!

#'	
,9?6		t__main__smain()s
(qt
__future__RR2R_R0R?R�RHR�RrR8R	R�tKeyboardInterruptRjR�tversion_infoRKR=R4t	NameErrorRRR`t
expanduserR#RdR:R!RRzR�R�R�R�R�R�R�R�R�R�R�R�RR
RR R'R.R/R7R;RARDRHRLRaRgRhRnR�R�R�R�RCR�R�R�R�R�R�R�R�R6R�R�R�R�R�R�R�R�R�R�R�R@R�R�R�R�RpRnR�RRqR�R�R�RCRSRTRERxRuR!RaR�R1RLR?RERR�(((s/usr/share/dstat/dstat.pyt<module>sBH@



*
&	��=8BAOBFD=3

	*										

			
			S									
			J	
	$		�	w			


Anon7 - 2021