관리-도구
편집 파일: process_collector.cpython-311.pyc
� �܋fF � � � d dl mZ d dlZddlmZmZ ddlmZ d dlZ ej � � Z n # e$ r dZ Y nw xY w G d� de� � Z e � � ZdS ) � )�unicode_literalsN� )�CounterMetricFamily�GaugeMetricFamily)�REGISTRYi c �0 � e Zd ZdZdd� defd�Zd� Zd� ZdS ) �ProcessCollectorz6Collector for Standard Exports such as cpu and memory.� c � � dS )N�self� r � �t/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/prometheus_client/process_collector.py�<lambda>zProcessCollector.<lambda> s � �� r z/procc � � || _ || _ || _ |r|dz | _ nd| _ d| _ t j d� � | _ n## t t t t f$ r Y nw xY wt | _ d| _ | � � � | _ n# t $ r Y nw xY w|r|� | � � d S d S )N� _process_�process_g Y@� SC_CLK_TCKr )� _namespace�_pid�_proc�_prefix�_ticks�os�sysconf� ValueError� TypeError�AttributeError�OSError� _PAGESIZE� _pagesize�_btime� _boot_time�IOError�register)r � namespace�pid�proc�registrys r �__init__zProcessCollector.__init__ s� � �#����� ��� �� &�$�{�2�D�L�L�%�D�L���� ��*�\�2�2�D�K�K���I�~�w�?� � � ��D� ���� #��� ��� ��/�/�+�+�D�K�K��� � � ��D� ����� $����d�#�#�#�#�#� $� $s# �A �A,�+A,�B � B*�)B*c �> � t t j � | j d� � d� � 5 }|D ]L}|� d� � r5t |� � � d � � c cd d d � � S �M d d d � � d S # 1 swxY w Y d S )N�stat�rbs btime r )�openr �path�joinr � startswith�float�split)r r, �lines r r# zProcessCollector._boot_time- s� � � �"�'�,�,�t�z�6�2�2�D� 9� 9� 2�T�� 2� 2���?�?�9�-�-� 2� ������a��1�1�1�1� 2� 2� 2� 2� 2� 2� 2� 2�2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2� 2���� 2� 2� 2� 2� 2� 2s �AB�B�B�Bc �f � | j sg S t j � | j t | � � � � � � � � � � }g } t t j � |d� � d� � 5 }|� � � � d� � d � � � }d d d � � n# 1 swxY w Y t | j dz dt |d � � �� � }t | j d z d t |d � � | j z �� � }t |d � � | j z }t | j d z d|| j z �� � }t |d � � | j z } t |d � � | j z } t! | j dz d| | z �� � }|� ||||g� � n# t$ $ r Y nw xY w t t j � |d� � d� � 5 }|D ]X} | � d� � rAt | j dz dt | � � � d � � �� � } n�Yd d d � � n# 1 swxY w Y t | j dz dt) t j t j � |d� � � � � � � � }|� ||g� � n# t$ t, f$ r Y nw xY w|S )Nr, r- � )����virtual_memory_byteszVirtual memory size in bytes.� )�value�resident_memory_byteszResident memory size in bytes.� � �start_time_secondsz6Start time of the process since unix epoch in seconds.� � �cpu_seconds_totalz0Total user and system CPU time spent in seconds.�limitss Max open file�max_fdsz(Maximum number of open file descriptors.� �open_fdsz Number of open file descriptors.�fd)r"