HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/libregrtest/__pycache__/win_utils.cpython-310.opt-1.pyc
o

�i��@s\ddlZddlZddlZddlZddlZddlZdZde�ed�ZdZ	Gdd�d�Z
dS)�N��<�c@sheZdZdZdd�Zejejfdd�Z	e
je
je
jfdd�Zdd	d
�Zejejejfdd�Zd
d�ZdS)�WindowsLoadTrackerz�
    This class asynchronously reads the performance counters to calculate
    the system load on Windows.  A "raw" thread is used here to prevent
    interference with the test suite's cases for the threading module.
    cCsPt�tj�g|_d|_t�dddd�|_t�dddd�|_t	�
|jdi�dS)NTF�)�winregZQueryInfoKey�HKEY_PERFORMANCE_DATA�_values�_load�_overlappedZCreateEvent�_running�_stopped�_thread�start_new_thread�_update_load��selfrr�7/usr/local/lib/python3.10/test/libregrtest/win_utils.py�__init__szWindowsLoadTracker.__init__cCs.||jd�r|��||jd�s||j�dS)Ni�)r�_calculate_loadr
)r�_wait�_signalrrrr&s�zWindowsLoadTracker._update_loadcCs�||d�\}}|d|d�\}|d||�\}}||}	||}
|
|	krC|d||
�\}}}
|
|7}
|dkr?|	|
}|d||�\}n|
|	ks"dS|jdurX|jt|dt|_dSt|j�tkrg|j�|�dSt|j�t|j�|_dS)N�2�L�Z4xLLZLL28xL�,g�?)r
�
LOAD_FACTOR_1�lenr	�NVALUE�append�sum)rZ_queryZ_hkeyZ_unpack�data�_Z	obj_startZ
data_startZ
defn_startZ	data_baseZ	defn_base�size�idx�offsetZcounter_offsetZprocessor_queue_lengthrrrr0s*
�


�z"WindowsLoadTracker._calculate_loadTcCs|��dS�N)�__del__)r�killrrr�closehszWindowsLoadTracker.closecCsH|jdur"||j�||jd�||j�||j�d|_|_dSdS)N���)rr
)rr�_closerrrrr'ls



�zWindowsLoadTracker.__del__cCs|jSr&)r
rrrr�
getloadavg{szWindowsLoadTracker.getloadavgN)T)�__name__�
__module__�__qualname__�__doc__r�_winapiZWaitForSingleObjectrZSetEventrrZQueryValueExr�struct�unpack_fromrr)ZCloseHandler'r,rrrrrs 
�
�
8
�r)rrr1�mathr2rZSAMPLING_INTERVAL�exprrrrrrr�<module>s