관리-도구
편집 파일: utils.cpython-39.pyc
a �����!c�����������������������@���s����d�Z�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlZ ddl Z ddlZddlZe� ejd��Ze �d�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�dnfc�����������������C���s���t�|��t�S�)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 ����1/usr/lib/python3.9/site-packages/dnf/cli/utils.py�jiffies_to_seconds���s����r���c�����������������C���sj���|�dkr0d|�d�|�d�d�|�d�d�|�d�f�S�|�dkrVd|�d�|�d�d�|�d�f�S�d|�d�|�d�f�S�)a��Return 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 i�Q�z%d day(s) %d:%02d:%02di�������<���z%d:%02d:%02dz %02d:%02dr ���)Zsecondsr ���r ���r����seconds_to_ui_time)���s���� ��r���c�����������������C���s���t�|��}�tj�d|���r4tj�d�r4tj�d|���s8dS�i�}td|����|}|D�]f}|d�dkr`qN|dd���dd�}t|�d k�r�qNtj� |d�d �|d<�|d�� ��||d�� �����<�qNW�d����n1�s�0����Y��d|vr�dS�d |vr�dS�d}td��>}|D�](}|�d�r�t�|td�d���}��q(q�W�d����n1��s>0����Y��|du��rVdS�td|����h}|� �����}|t|d���|d<�td�td�td�td�td�d��|d �td��|d<�W�d����n1��s�0����Y��|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)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<���sR���� ��< ( ��(r.���c�����������������C���s����t�|��}|s$td�}t�||���dS�td�|�|d�f�}t�d|��t�td�tt|d��d��tt|d ��d����ttt����|d ���}t�td�tj � |d ��|��t�td�|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)r���i���r���r���z Started: %s - %s agoz State : %sr���)r.���r����loggerZcriticalr���r���r����timer���r$���Znormalize_time)r*���r+����msgZagor ���r ���r����show_lock_ownerl���s"���� � �r3���)�__doc__Z __future__r���r���Zdnf.cli.formatr���Zdnf.i18nr���Zdnf.utilr���Zloggingr���r1����sysconf� sysconf_namesr ���Z getLoggerr0���r���r���r.���r3���r ���r ���r ���r����<module>���s��� 0