
    -_g*                     @    d dl Z d dlZd dlmZmZmZ  G d dee      Zy)    N)PluginIndependentPlugin	PluginOptc            
           e Zd ZdZdZdZ eddd       edd	d
       edd	d       edded       edded      gZd Z	d Z
y)Processzprocess information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   val_typer   numprocsi   z*number of process to collect /proc data ofc           
         d}d}d}|dz  }| j                  g d       | j                  d      D cg c]  }t        j                  d|      s| }}| j	                  d      r|d | j	                  d       }|D ],  }| j                  d	| d
d	| dd	| dd	| dd	| dg       . | j	                  d      r| j                  d       | j                  ddg dd       | j                  dd       | j	                  d      r| j                  ddddd       | j	                  d      r| j                  ddd        | j                  g d!d"#       | j                  | d$| | d$| g       | j	                  d%      r%| j                  d&| j	                  d%       d'(       | j                  d)d*g       y c c}w )+Nzps axoz3pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroupz3flags,state,uid,pid,ppid,pgid,sid,cls,pri,psr,addr,zsz,wchan:20,lstart,tty,time,cmd)z/proc/sched_debugz
/proc/statz/sys/kernel/debug/sched/debugz /sys/kernel/debug/sched/featuresz/sys/kernel/sched_ext/z/procz[0-9]r   z/proc/z/statusz/cpusetz/oom_*z/stackz/limitsr   z/proc/[0-9]*/smapsz
ps auxwwwmps)ps_auxps_auxww	ps_auxwww
ps_auxwwwm	ps_auxcww   )root_symlinktagspriorityz
pstree -lppstree)r   r
   zlsof +M -n -l -c ''   2   )r   timeoutr   r   r   zlsof +M -n -l)r!   r   )z	ps alxwwwz
ps auxfwwwzps -elfLT)
cmd_as_tag r   ziotop -b -o -d 0.5 -t -n d   )r   z#pidstat -p ALL -rudvwsRU --human -hzpidstat -tl)add_copy_speclistdirrematch
get_optionadd_cmd_output)selfps_axops_group_optsps_sched_optspprocsprocs          </usr/lib/python3/dist-packages/sos/report/plugins/process.pysetupzProcess.setup!   s&   MM:: 
 	 !LL1JqRXXgq5IJJ??:&64??:67E 	Dg&g&f%f%g&  	 ??7#34Lt"=%& 	 	(
 	Lx@??6" 5F(*Rf   F ??>*bI 
 	 	 	 	ha'ha'
 	
 ??9% ;#'??9#=">!@),   . 	1
 	[ Ks   F>F>c                    | j                  d      5 }| j                  j                  j                  s|j	                  d       	 d d d        y | j                  d      }i }i }|d   dk(  s!|j	                  d|d           	 d d d        y |d   j                         D ]s  }|j                         j                         }|d   }|d   }| j                  |      s=||vr(| j                  j                  j                  |      ||<   |||   d	||<   u |j	                  t        j                  |d
             d d d        y # 1 sw Y   y xY w)Nzpids_to_packages.jsonz/Package manager not configured for path querieszps --no-headers aexstatusr   zUnable to get process list: output   )pathpackage)indent)collection_filepolicypackage_managerquery_path_commandwriteexec_cmd
splitlinesstripsplitpath_existspkg_by_pathjsondumps)r+   pfile_pspidpkgpathsr1   pidr8   s           r2   collectzProcess.collectb   sI   !!"9: 	6e;;..AAMN	6 	6 -- 56CFEx=A%:3x=/JK	6 	6 H002 Ezz|))+1gAw''-u$"&++"="="I"I$"OE$K'+dDsE KK

6!45)	6 	6 	6s   3E5EB/EEN)__name__
__module____qualname__
short_descplugin_nameprofilesr   intoption_listr3   rM        r2   r   r      sr    &JKH 	&$-MN.%F	H'5/LM)R#;	=*dSC	E	K?B6rW   r   )rF   r'   sos.report.pluginsr   r   r   r   rV   rW   r2   <module>rY      s$     	 C Ch6f' h6rW   