o
    *b                     @   s2   d dl Z d dlmZmZmZ G dd deeZdS )    N)PluginIndependentPlugin	PluginOptc                
   @   sd   e Zd ZdZdZdZeddddedd	d
dedd	ddeddeddeddeddgZdd Z	dS )Processzprocess informationZprocess)systemlsofTzcollect info on all open files)defaultdesclsof-threadsFz,collect threads' open file info if supportedsmapszcollect /proc/*/smaps filessamples   z"number of iotop samples to collect)r   Zval_typer	   numprocsi   z*number of process to collect /proc data ofc              	   C   sV  d}d}d}|d7 }|  ddg dd | d	D }| d
r)|d | d
 }|D ]}|  d| d| d| d| d| g q+| drL|  d | jddg ddd | jddd | drl| jddddd | dry| jd ddd! | jd"d#gd$d% | d&||f d&||f g | d'r| jd(| d' d)d* | d+d,g d S )-Nzps axoz3pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroupz2flags,state,uid,pid,ppid,pgid,sid,cls,pri,addr,sz,zwchan:20,lstart,tty,time,cmdz/proc/sched_debugz
/proc/statc                 S   s   g | ]
}t d |r|qS )z[0-9])rematch).0p r   </usr/lib/python3/dist-packages/sos/report/plugins/process.py
<listcomp>,   s    z!Process.setup.<locals>.<listcomp>z/procr   z/proc/%s/statusz/proc/%s/cpusetz/proc/%s/oom_*z/proc/%s/stackz/proc/%s/limitsr   z/proc/[0-9]*/smapsz
ps auxwwwmZps)Zps_auxZps_auxwwZ	ps_auxwwwZ
ps_auxwwwmZinsights_ps_auxcww   )root_symlinkZtagspriorityz
pstree -lpZpstree)r   r   zlsof +M -n -l -c ''   2   )r   timeoutr   r
   zlsof +M -n -l)r   r   z	ps alxwwwzps -elfLT)Z
cmd_as_tagz%s %sr   ziotop -b -o -d 0.5 -t -n %sd   )r   z#pidstat -p ALL -rudvwsRU --human -hzpidstat -tl)Zadd_copy_speclistdirZ
get_optionZadd_cmd_output)selfZps_axoZps_group_optsZps_sched_optsZprocsprocr   r   r   setup    sh   








zProcess.setupN)
__name__
__module____qualname__Z
short_descZplugin_nameZprofilesr   intZoption_listr    r   r   r   r   r      s"    r   )r   Zsos.report.pluginsr   r   r   r   r   r   r   r   <module>   s   