Your IP : 216.73.216.213
B
�d{T�$ � @ s` d Z dZddlZddlZddlmZmZmZmZ ddl m Z m
Z
mZmZm
Z
ddlmZmZmZmZ ddlmZ ddlmZ G d d
� d
e�Zdd� Zd
ZdZdZdZdZdZG dd� de�ZG dd� d�Z yG dd� de!�Z"W n& e#k
�r G dd� de�Z"Y nX G dd� de"�Z$G dd� de"�Z%G dd� de"�Z&e"e'fZ(G d d!� d!e�Z)G d"d#� d#�Z*dS )$z�module providing:
* process information (linux specific: rely on /proc)
* a class for resource control (memory / time / cpu time)
This module doesn't work on windows platforms (only tested on linux)
:organization: Logilab
zrestructuredtext en� N)� getrlimit� setrlimit�
RLIMIT_CPU� RLIMIT_AS)�signal�SIGXCPU�SIGKILL�SIGUSR2�SIGUSR1)�Timer�
currentThread�Thread�Event)�time)�Nodec @ s e Zd ZdS )�
NoSuchProcessN)�__name__�
__module__�__qualname__� r r �D/opt/alt/python37/lib/python3.7/site-packages/logilab/common/proc.pyr ( s r c C s t j�d| �st� �dS )zTcheck the a pid is registered in /proc
raise NoSuchProcess exception if not
z/proc/%sN)�os�path�existsr )�pidr r r �proc_exists* s r � �
� � � � c @ sJ e Zd ZdZdd� Zdd� Zdd� Zdd d
�Zdd� Zd
d� Z dd� Z
dS )�ProcInfoz4provide access to process information found in /procc C sD t |�| _t�| | j� t| j� d| j | _t | �� t �| _d S )Nz
/proc/%s/stat) �intr r �__init__r �file�status�PPID�ppid)�selfr r r r r$ ; s
zProcInfo.__init__c C s* yt | �� t �S tk
r$ dS X dS )z,return the memory usage of the process in Kor N)r# r&