HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/process.cpython-38.pyc
U

i��d{�@s:ddlZddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�IndependentPlugin�	PluginOptc
@sleZdZdZdZdZedddd�edd	d
d�edd	dd�ed
dedd�eddedd�gZdd�Z	dd�Z
dS)�Processzprocess informationZprocess)�system�lsofTzcollect info on all open files)�default�desc�lsof-threadsFz,collect threads' open file info if supported�smapszcollect /proc/*/smaps files�samples�z"number of iotop samples to collect)rZval_typer	�numprocsiz*number of process to collect /proc data ofc	Cs`d}d}d}|d7}|�ddg�dd�|�d	�D�}|�d
�rR|d|�d
��}|D],}|�d|d|d
|d|d|g�qV|�d�r�|�d�|jdddddddgdd�|jddd�|�d�r�|jddd d!dd"�|�d#�r�|jd$d d!d%�|jd&d'gd(d)�|�d*||fd*||fg�|�d+��rN|jd,|�d+�d-d.�|�d/d0g�dS)1Nzps axoz3pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroupz2flags,state,uid,pid,ppid,pgid,sid,cls,pri,addr,sz,zwchan:20,lstart,tty,time,cmdz/proc/sched_debugz
/proc/statcSsg|]}t�d|�r|�qS)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/procrz/proc/%s/statusz/proc/%s/cpusetz/proc/%s/oom_*z/proc/%s/stackz/proc/%s/limitsrz/proc/[0-9]*/smapsz
ps auxwwwmZpsZps_auxZps_auxwwZ	ps_auxwwwZ
ps_auxwwwmZ	ps_auxcww�)�root_symlink�tags�priorityz
pstree -lpZpstree)rrzlsof +M -n -l -c ''��2)r�timeoutrrr
z
lsof +M -n -l)rrz	ps alxwwwzps -elfLT)Z
cmd_as_tagz%s %srziotop -b -o -d 0.5 -t -n %s�d)rz#pidstat -p ALL -rudvwsRU --human -hzpidstat -tl)Z
add_copy_spec�listdirZ
get_optionZadd_cmd_output)�selfZps_axoZ
ps_group_optsZ
ps_sched_optsZprocs�procrrr�setup!sr�
�

��
�
��

����z
Process.setupc	Cs�|�d���}|jjjs.|�d�W5QR�dS|�d�}i}i}|ddksn|�d|d���W5QR�dS|d��D]X}|����}|d}|d}|�	|�s�qz||kr�|jj�
|�||<|||d	�||<qz|�tj|dd
��W5QRXdS)Nzpids_to_packages.jsonz/Package manager not configured for path querieszps --no-headers aexZstatusrzUnable to get process list: �output�)�path�package)�indent)
Zcollection_fileZpolicyZpackage_managerZquery_path_command�writeZexec_cmd�
splitlines�strip�splitZpath_existsZpkg_by_path�json�dumps)rZpfileZ_psZpidpkg�pathsr �pidr$rrr�collect]s(



zProcess.collectN)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr�intZoption_listr!r/rrrrrs"����<r)r+rZsos.report.pluginsrrrrrrrr�<module>	s