KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : andertr9 ( 1047)
PHP Version : 8.2.18
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/tuned/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyc
�
��\c@s�ddlmZddlTddlZddlmZddljZddl	Z	ddl
Z
ddlZddlZddl
Z
ejj�Zdejfd��YZdS(i(tbase(t*i����N(tcommandstCPULatencyPlugincBs�eZdZd�Zd�Zd�Zed��Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zed�Zd�Zd�Zd�Zd�Zd�Zedde�d��Zed�ed��Zdd�Z eddedd�d ��Z!ed�ed!��Z"d"�Z#ed#de�d$��Z$d%�Z%d&�Z&d'�Z'ed#�ed(��Z(RS()sP
	Plugin for tuning CPU options. Powersaving, governor, required latency, etc.
	cOs�tt|�j||�t|_d|_t|_t|_t|_	t|_
t|_d|_
d|_d|_i|_t�|_dS(Ntx86_64(tsuperRt__init__tTruet_has_pm_qost_archtFalset_is_x86t	_is_intelt_is_amdt_has_energy_perf_biast_has_intel_pstatetNonet_min_perf_pct_savet_max_perf_pct_savet_no_turbo_savet_governors_mapRt_cmd(tselftargstkwargs((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyRs											cCsUt|_t�|_x-|jjd�D]}|jj|j�q(Wt�|_dS(Ntcpu(	Rt_devices_supportedtsett
_free_devicest_hardware_inventorytget_devicestaddtsys_namet_assigned_devices(Rtdevice((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt
_init_devices(s
	cCs&g|D]}|jjd|�^qS(NR(Rt
get_device(Rtdevicestx((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_get_device_objects1scCsJi
dd6dd6dd6dd6dd6dd	6dd
6dd6dd6dd
6S(Ng�������?tload_thresholdidtlatency_lowi�tlatency_hight
force_latencytgovernortsampling_down_factortenergy_perf_biastmin_perf_pcttmax_perf_pcttno_turbo(R(R((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_get_config_options4scCs�dddddg}tj�|_|j|kr�tj�}|jjd�}|dkrit|_n-|dks�|d	kr�t|_	n	t|_t
jd
|�nt
jd|j�|jtkr�|j�|j
�ndS(NRti686ti585ti486ti386t	vendor_idtGenuineInteltAuthenticAMDtHygonGenuines$We are running on an x86 %s platformsWe are running on %s (non x86)(tplatformtmachineR	tprocfstcpuinfottagstgetRRR
tlogtinfot_check_energy_perf_biast_check_intel_pstate(Rtintel_archsRtvendor((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_check_archCs	
cCst|_d}|jjddgdtj|g�d}|dkrRt|_n)|dkrntjd�n
tjd�dS(Nitx86_energy_perf_policys-rt	no_errorsisgunable to run x86_energy_perf_policy tool, ignoring CPU energy performance bias, is the tool installed?sXyour CPU doesn't support MSR_IA32_ENERGY_PERF_BIAS, ignoring CPU energy performance bias(	R
RRtexecuteterrnotENOENTRRAtwarning(Rtretcode_unsupportedtretcode((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyRC^s	+cCs2tjjd�|_|jr.tjd�ndS(Ns$/sys/devices/system/cpu/intel_pstatesintel_pstate detected(tostpathtexistsRRARB(R((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyRDis	cCs.t|�}|jjt|�jdd��S(NRt(tstrRt
is_cpu_onlinetreplace(RR"tsd((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_is_cpu_onlinenscCstjjd|�S(Ns3/sys/devices/system/cpu/%s/cpufreq/scaling_governor(RPRQRR(RR"((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_cpu_has_scaling_governorrscCsL|j|�s$tjd|�tS|j|�sHtjd|�tStS(Ns'%s' is not online, skippings.there is no scaling governor fo '%s', skipping(RXRAtdebugR
RYR(RR"((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_check_cpu_can_change_governoruscCst|_t|_t|jj��d|kr�t|_ytj	t
jtj�|_
Wn.tk
r�tjdt
j�t|_nXd|_|jddkr�|jjdd�|_t|_n	d|_|j�nt|_tjd|j�t|j�d|_dS(Nis-Unable to open '%s', disabling PM_QoS controlR+tloadsILatency settings from non-first CPU plugin instance '%s' will be ignored.(Rt_has_static_tuningR
t_has_dynamic_tuningtlistt
_instancestvaluest_first_instanceRPtopentconststPATH_CPU_DMA_LATENCYtO_WRONLYt_cpu_latency_fdtOSErrorRAterrorRRt_latencytoptionst_monitors_repositorytcreatet
_load_monitorRGRBtnametassigned_devicest
_first_device(Rtinstance((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_instance_init~s$			

		
	cCsQ|jrM|jr%tj|j�n|jdk	rM|jj|j�qMndS(N(	RbRRPtcloseRgRnRRltdelete(RRr((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_instance_cleanup�s
		cCs|jjd|d�j�S(Ns'/sys/devices/system/cpu/intel_pstate/%s(Rt	read_fileRtstrip(Rtattr((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_get_intel_pstate_attr�scCs*|dk	r&|jjd||�ndS(Ns'/sys/devices/system/cpu/intel_pstate/%s(RRt
write_to_file(RRytval((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_set_intel_pstate_attr�scCs3|dkrdS|j|�}|j||�|S(N(RRzR}(RRytvaluetv((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_getset_intel_pstate_attr�s
cCs�tt|�j|�|js#dS|jd}|dk	rL|j|�n|jr�|jd|jd�|_	|jd|jd�|_
|jd|jd�|_ndS(NR+R/R0R1(RRt_instance_apply_staticRbRkRt_set_latencyRR�RRR(RRrtforce_latency_value((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyR��s	
	cCsktt|�j||�|jrg|jrg|jd|j�|jd|j�|jd|j�ndS(NR/R0R1(	RRt_instance_unapply_staticRbRR}RRR(RRrt
full_rollback((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyR��s
cCs|j||�dS(N(t_instance_update_dynamic(RRrR"((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_instance_apply_dynamic�scCsw|jst�||jkr"dS|jj�d}||jdkr_|j|jd�n|j|jd�dS(NtsystemR(R*R)(RbtAssertionErrorRqRntget_loadRkR�(RRrR"R\((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyR��scCsdS(N((RRrR"((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_instance_unapply_dynamic�scCsjt|�}|jrf|j|krftjd|�tjd|�}tj|j	|�||_ndS(Nssetting new cpu latency %dti(
tintRRjRARBtstructtpackRPtwriteRg(Rtlatencytlatency_bin((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyR��scCs |jjd|�j�j�S(Ns>/sys/devices/system/cpu/%s/cpufreq/scaling_available_governors(RRwRxtsplit(RR"((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_get_available_governors�sR,t
per_devicecCs,|j|�sdSt|�}|jd�}g|D]}|j�^q5}x1|D])}t|�dkrTtjd�dSqTW|j|�}x�|D]m}||kr�|s�tj	d||f�|j
jd||�nPq�|s�tjd||f�q�q�Wtj
ddj|��d}|S(	Nt|is.The 'governor' option contains an empty value.s!setting governor '%s' on cpu '%s's3/sys/devices/system/cpu/%s/cpufreq/scaling_governors7Ignoring governor '%s' on cpu '%s', it is not supporteds.None of the scaling governors is supported: %ss, (R[RRTR�RxtlenRARiR�RBRR{RZtwarntjoin(Rt	governorsR"tsimR,tavailable_governors((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt
_set_governor�s2


			cCszd}|j|�sdS|jjd|d|�j�}t|�dkrV|}n|dkrvtjd|�n|S(Ns3/sys/devices/system/cpu/%s/cpufreq/scaling_governortno_erroris*could not get current governor on cpu '%s'(RR[RRwRxR�RARi(RR"tignore_missingR,tdata((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt
_get_governor�s"	tondemandcCsd|S(Ns7/sys/devices/system/cpu/cpufreq/%s/sampling_down_factor((RR,((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_sampling_down_factor_pathsR-tpriorityi
cCsd}||jkr%|jj�nd|j|<|j|�}|dkrbtjd|�dS|t|jj��kr||j|<|j|�}t	j
j|�s�tjd||f�dSt|�}|stj
d||f�|jj||�qn|S(NsIignoring sampling_down_factor setting for CPU '%s', cannot match governorsTignoring sampling_down_factor setting for CPU '%s', governor '%s' doesn't support its6setting sampling_down_factor to '%s' for governor '%s'(RRtclearR�RARZR_RaR�RPRQRRRTRBRR{(RR-R"R�R|R,RQ((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_set_sampling_down_factors&

cCs`|j|d|�}|dkr%dS|j|�}tjj|�sJdS|jj|�j�S(NR�(	R�RR�RPRQRRRRwRx(RR"R�R,RQ((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_get_sampling_down_factor)scCs=|jjdd|t|�gdt�\}}}||fS(NRHs-ct
return_err(RRJRTR(Rtcpu_idR~ROtoutterr_msg((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_try_set_energy_perf_bias3s	R.c	Cs"|j|�s$tjd|�dS|jr|s|jd�}|jd�}x�|D]�}|j�}tjd||f�|j||�\}}|dkr�tj	d||f�PqX|dkr�tj
d|�PqXtjd||f�qXWtj
d	|�nt|�SdSdS(
Ns%s is not online, skippingRR�s2Trying to set energy_perf_bias to '%s' on cpu '%s'is5energy_perf_bias successfully set to '%s' on cpu '%s's"Failed to set energy_perf_bias: %ssHCould not set energy_perf_bias to '%s' on cpu '%s', trying another valuesPFailed to set energy_perf_bias on cpu '%s'. Is the value in the profile correct?(RXRARZRRtlstripR�RxR�RBRiRT(	RR.R"R�R�tvalsR|ROR�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_set_energy_perf_bias<s6	
					
cCsYyt|�}WnBtk
rT}yt|d�}WqUtk
rP}|}qUXnX|S(Ni(R�t
ValueError(RtsRte((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_try_parse_num]scCs.idd6dd6dd6j|j|�|�S(Ntperformanceitnormalit	powersavei(R@R�(RR�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_energy_perf_policy_to_humanhscCs<idd6dd6dd6dd6d	d
6j|j|�|�S(NR�isbalance-performanceiR�is
balance-poweritpoweri(R@R�(RR�((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_energy_perf_policy_to_human_v2ls

c	Cs�d}|j|�s*tjd|�dS|jr�|jd�}|jjdd|dg�\}}|dkr�xu|j�D]d}|j	�}t
|�dkr�|j|d�}Pqt
|�d	kr|j|d�}PqqWq�n|S(
Ns%s is not online, skippingRRHs-cs-riiii(
RRXRARZRR�RRJt
splitlinesR�R�R�R�(	RR"R�R.R�ROtlinestlinetl((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt_get_energy_perf_biasts"	$()t__name__t
__module__t__doc__RR#R'tclassmethodR2RGRCRDRXRYR[RsRvRzR}R�R�R
R�R�R�R�R�R�tcommand_setRR�tcommand_getR�R�R�R�R�R�R�R�R�R�(((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyRsJ																							
!				!				(RSRt
decoratorst
tuned.logsttunedttuned.utils.commandsRttuned.constsRdRPR�RKR;R=tlogsR@RAtPluginR(((s</usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.pyt<module>s


Anon7 - 2021