File: //lib/python3.9/site-packages/procfs/__pycache__/procfs.cpython-39.pyc
a
�{Meʍ � @ s� d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z dZ
dd� Zdd � ZG d
d� d�Z
dd
� Zdd� ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG d d!� d!�ZG d"d#� d#�Zed$k�r�d dlZe� Zeej�� �D ]Ze e� d%eje � �� �q(e� Z!ee!j!�� �D ]Z"e e"� d%e!j!e" � �� �q\e� Z#e d&e#j$� d'�� ee#�� �D ]Z%e e%� d(e#e% � �� �q�e d)� ee&ej'd* ��Z(ee(j)�D ]*Ze e(j*e j+d+�d,e(j*e j,� �� �q�e d-� e(�-ej'd. �D ]Z.e e.d/ � �q&e� Z/e e/d* � e� Z0e�1d*� e0�2� e0D ]Z#e e#� d%e0e# � �� �qhe d0� �qRdS )1� N)�reduce)�range)�bitmasklistz0.7.3c C s t �� } tt�d| ��S )z) Return True if running on s390 or s390x Zs390)�platform�machine�bool�re�search)r � r
�1/usr/lib/python3.9/site-packages/procfs/procfs.py�is_s390 s r c C s@ | d rt dd� | d ��� S z| d d W S Y dS 0 dS )z�
Returns the process command line, if available in the given `process' class,
if not available, falls back to using the comm (short process name) in its
pidstat key.
�cmdlinec S s | d| S )Nz %sr
)�a�br
r
r �<lambda>! � z!process_cmdline.<locals>.<lambda>�stat�commN)r �strip)Zpid_infor
r
r �process_cmdline s r c @ s� e Zd ZdZdZdZdZdZdZdZ dZ
d Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d!Z'g d"�Z(d9d$d%�Z)d&d'� Z*d(d)� Z+d*d+� Z,d,d-� Z-d.d/� Z.d0d1� Z/d:d2d3�Z0d4d5� Z1d6d7� Z2d8S );�pidstatam
Provides a dictionary to access the fields in the
per process /proc/PID/stat files.
One can obtain the available fields by asking for the keys of the
dictionary, e.g.:
>>> p = procfs.pidstat(1)
>>> print p.keys()
['majflt', 'rss', 'cnswap', 'cstime', 'pid', 'session', 'startstack', 'startcode', 'cmajflt', 'blocked', 'exit_signal', 'minflt', 'nswap', 'environ', 'priority', 'state', 'delayacct_blkio_ticks', 'policy', 'rt_priority', 'ppid', 'nice', 'cutime', 'endcode', 'wchan', 'num_threads', 'sigcatch', 'comm', 'stime', 'sigignore', 'tty_nr', 'kstkeip', 'utime', 'tpgid', 'itrealvalue', 'kstkesp', 'rlim', 'signal', 'pgrp', 'flags', 'starttime', 'cminflt', 'vsize', 'processor']
And then access the various process properties using it as a dictionary:
>>> print p['comm']
systemd
>>> print p['priority']
20
>>> print p['state']
S
Please refer to the 'procfs(5)' man page, by using:
$ man 5 procfs
To see information for each of the above fields, it is part of the
'man-pages' RPM package.
� � � � � � �@ � � i i i i i i @ i � i i i i i i i @ i � i i � i i i i @l )+�pidr �stateZppidZpgrpZsessionZtty_nrZtpgid�flagsZminfltZcminfltZmajfltZcmajflt�utimeZstimeZcutimeZcstime�priority�niceZnum_threadsZitrealvalueZ starttimeZvsizeZrssZrlimZ startcodeZendcodeZ
startstackZkstkespZkstkeip�signalZblockedZ sigignoreZsigcatchZwchanZnswapZcnswapZexit_signal� processor�rt_priorityZpolicyZdelayacct_blkio_ticks�environ�/procc C s. || _ z| �|� W n ty( � Y n0 d S �N)r! �load�FileNotFoundError��selfr! �basedirr
r
r �__init__~ s
zpidstat.__init__c C s
| j | S r, ��fields�r0 Z fieldnamer
r
r �__getitem__� s zpidstat.__getitem__c C s t | j�� �S r, ��listr4 �keys�r0 r
r
r r9 � s zpidstat.keysc C s t | j�� �S r, �r8 r4 �valuesr: r
r
r r<