AlkantarClanX12
Current Path : /usr/lib/python3.6/site-packages/procfs/__pycache__/ |
Current File : //usr/lib/python3.6/site-packages/procfs/__pycache__/procfs.cpython-36.pyc |
3 �{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� Zx0eejj� �D ]Ze e� d%eje � �� �q*W e� Z!x0ee!j!j� �D ]Z"e e"� d%e!j!e" � �� �qbW e� Z#e d&e#j$� d'�� x,ee#j� �D ]Z%e e%� d(e#e% � �� �q�W e d)d*d+ � ee&ej'd, ��Z(x8ee(j)�D ]*Ze e(j*e j+d-�d.e(j*e j,� �� �q�W e d*d+ � x&e(j-ej'd/ �D ]Z.e e.d0 � �qDW e� Z/e e/d, � e� Z0xFej1d,� e0j2� x$e0D ]Z#e e#� d%e0e# � �� �q�W e d2� �qtW dS )3� N)�reduce)�range)�bitmasklistz0.7.3c C s t j� } ttjd| ��S )z) Return True if running on s390 or s390x Zs390)�platform�machine�bool�re�search)r � r �/usr/lib/python3.6/procfs.py�is_s390 s r c C s: | d rt dd� | d �j� S y| d d S dS 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>! s z!process_cmdline.<locals>.<lambda>�stat�commN)r �strip)Zpid_infor r r �process_cmdline s r c + @ sN e Zd ZdZdZdZdZdZdZdZ dZ d Zd ZdZ dZd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d!Z'd"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLg+Z(dcdNdO�Z)dPdQ� Z*dRdS� Z+dTdU� Z,dVdW� Z-dXdY� Z.dZd[� Z/ddd\d]�Z0d^d_� Z1d`da� Z2dbS )e�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 i @l �pidr �stateZppidZpgrpZsessionZtty_nrZtpgid�flagsZminfltZcminfltZmajfltZcmajflt�utimeZstimeZcutimeZcstimeZpriority�niceZnum_threadsZitrealvalueZ starttimeZvsizeZrssZrlimZ startcodeZendcodeZ startstackZkstkespZkstkeip�signalZblockedZ sigignoreZsigcatchZwchanZnswapZcnswapZexit_signal� processor�rt_priorityZpolicyZdelayacct_blkio_ticks�environ�/procc C s0 || _ y| j|� W n tk r* � Y nX d S )N)r �load�FileNotFoundError)�selfr �basedirr r r �__init__~ s zpidstat.__init__c C s | j | S )N)�fields)r+ � fieldnamer r r �__getitem__� s zpidstat.__getitem__c C s t | jj� �S )N)�listr. �keys)r+ r r r r2 � s zpidstat.keysc C s t | jj� �S )N)r1 r. �values)r+ r r r r3 � s zpidstat.valuesc C s || j kS )N)r. )r+ r/ r r r �has_key� s zpidstat.has_keyc C s | j S )N)r. )r+ r r r �items� s z pidstat.itemsc C s || j kS )N)r. )r+ r/ r r r �__contains__� s zpidstat.__contains__c C s� yt |� d| j� d��}W n tk r0 � Y nX |j� j� jd�}|j� |d jd�|d j� }i | _tt |�t | j ��}xft|�D ]Z}| j | }|| }|dkr�|jd�| jd<