AlkantarClanX12

Your IP : 3.142.171.100


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/dnf/cli/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/dnf/cli/__pycache__/utils.cpython-36.pyc

3

�ft`��@s�dZddlmZddlmZddlmZddlmZddlZ	ddl
Z
ddlZddlZej
ejd�Ze
jd�Zd	d
�Zdd�Zd
d�Zdd�ZdS)z/Various utility functions, and a utility class.�)�absolute_import)�unicode_literals)�
format_number)�_N�
SC_CLK_TCK�dnfcCst|�tS)z�Convert a number of jiffies to seconds. How many jiffies are in a second
    is system-dependent, e.g. 100 jiffies = 1 second is common.

    :param jiffies: a number of jiffies
    :return: the equivalent number of seconds
    )�int�_USER_HZ)Zjiffies�r
�/usr/lib/python3.6/utils.py�jiffies_to_secondssrcCsj|dkr0d|d	|d
d|dd|dfS|dkrVd|d|dd|dfSd|d|dfS)
aReturn a human-readable string representation of the length of
    a time interval given in seconds.

    :param seconds: the length of the time interval in seconds
    :return: a human-readable string representation of the length of
      the time interval
    �<�z%d day(s) %d:%02d:%02dz%d:%02d:%02dz	%02d:%02dii�Qii�Qiiir
)Zsecondsr
r
r�seconds_to_ui_time)s

rcCs�t|�}tjjd|�s:tjjd�s:tjjd|�r>dSi}td|��v}xn|D]f}|ddkrhqV|dd�jdd�}t|�dkr�qVtjj	|dd	�|d<|dj
�||d
j
�j�<qVWWdQRXd|kr�dSd|kr�dSd}td��4}x,|D]$}|jd
�r�t|td
�d��}Pq�WWdQRX|dk�r6dStd|��^}|j
�j�}|t|d�|d<td�td�td�td�td�d�j|dtd��|d<WdQRX|S)z!Return info dict about a process.z/proc/%d/statusz
/proc/statz
/proc/%d/statN��
z:	�z kBr�vmrss�vmsizezbtime ��
start_timeZRunningZSleepingZUninterruptibleZZombiezTraced/Stopped)�R�S�D�Z�TZUnknown�state���rr)r�os�path�exists�open�split�lenr�utilZrtrim�strip�lower�
startswith�readrr�get)�pid�psZstatus_file�line�dataZ	boot_timeZ	stat_fileZps_statr
r
r�get_process_info<sJ
*



r.cCs�t|�}|s$td�}tj||�dStd�||df}tjd|�tjtd�tt|d�d�tt|d	�d��tttj��|d
�}tjtd�tj	j
|d
�|�tjtd�|d
�dS)z0Output information about process holding a lock.z=Unable to find information about the locking process (PID %d)Nz$  The application with PID %d is: %s�namez%sz    Memory : %5s RSS (%5sB VSZ)rirrz    Started: %s - %s agoz    State  : %sr)r.r�loggerZcriticalrrr�timerr$Znormalize_time)r*r+�msgZagor
r
r�show_lock_ownerls

r3)�__doc__Z
__future__rrZdnf.cli.formatrZdnf.i18nrZdnf.utilrZloggingrr1�sysconf�
sysconf_namesr	Z	getLoggerr0rrr.r3r
r
r
r�<module>s

0