+
     Gi  c                   s    ^RI Ht ^RI5 ^ RIt^ RIHt ^ RIt^ RIt]P                  P                  4       t]! 4       tRt^ t^t ! R R]P                   4      tR# )   )hotplug)Z*N)commandsz//sys/devices/system/cpu/intel_uncore_frequency/c                   s   a  ] tR t^t o RtR tR tR tR tR t	R t
]R 4       tR	 tR
 tR t]! RRR7      R 4       t]! R4      RR l4       t]! RRR7      R 4       t]! R4      RR l4       tRtV tR# )UncorePlugina  
An Intel-specific plug-in for limiting the maximum and minimum uncore frequency.

The options [option]`max_freq_khz`, [option]`min_freq_khz` correspond to
`sysfs` files exposed by Intel uncore frequency driver. Their values can be
specified in kHz or as a percentage of their configurable range.

.Limiting maximum uncore frequency
====
----
[uncore10]
type=uncore
devices=uncore10
max_freq_khz=4000000

[uncore_all]
type=uncore
max_freq_khz=90%
----
Using this options *TuneD* will limit maximum frequency of all uncore units
on the Intel system to 90% of the allowable range. Except uncore10 which
maximum frequency limit will be set to 4 GHz.
====
c                s   R V n         \        4       V n        \        4       V n        RV n         \
        P                  ! \        4      p\        P                  ! TR4      p\        T4      ^ 8  d
   R T n        TpT F  pT P                  P                  T4       K   	  \        P                  R\        T P                  4      4       R#   \         d     R# i ; i)TFNzuncore*zdevices: %s)_devices_supportedZset_assigned_devices_free_devices_is_tpmiosZlistdir	SYSFS_DIROSErrorfnmatchZfilterlenZaddlogdebugstr)selfZdevicesZtpmi_devicesZds   &   @/usr/lib/python3.14/site-packages/tuned/plugins/plugin_uncore.py_init_devicesZUncorePlugin._init_devices+   s     $5$u$$-
ZZ	"7
 3,4=7a!  ))M3t1123 
 
	
s   C CCc                s"    R Vn         RVn        R# )TFN)Z_has_static_tuningZ_has_dynamic_tuningr   instance   &&r   _instance_initZUncorePlugin._instance_initA   s     $(!&(    c                s    R # )N r   r   r   _instance_cleanupZUncorePlugin._instance_cleanupE   s    r   c                s    \         V,           R ,           V,           p\        P                  V4      p\        V4      ^ 8  d   \	        V4      # R# )/N)r	   cmdZ	read_filer   int)r   dev_dirfile
sysfs_filevalues   &&&  r   _getZUncorePlugin._getH   s<    7"S(4/*
--

#%Z!^
e*	r   c                s    \         V,           R ,           V,           p\        P                  VRV,          4      '       d   V# R# )r   z%uN)r	   r   Zwrite_to_file)r   r   r   r    r      &&&& r   _setZUncorePlugin._setO   s5    7"S(4/*z4%<00
<	r   c                s     V P                  VR 4      pV P                  VR4      pV P                  VR4      pV P                  VR4      pY#YE3#   \        \        3 d    \        P	                  R4        R# i ; i)initial_max_freq_khzinitial_min_freq_khzmax_freq_khzmin_freq_khz$fail to read uncore frequency valuesN)r!   r
   IOErrorr   error)r   devicer$   r%   r&   r'   s   &&    r   _get_allZUncorePlugin._get_allU   s~    ))F,BC))F,BC))FN3<))FN3< l	QQ 7	 9934
s   AA &A87A8c                s    R RRR/# )r&   Nr'   r   )Zclss   &r   _get_config_optionsZ UncorePlugin._get_config_options`   s     44
 r   c                s    \        V4      pT P	                  T4      pTf   R# Tw  rgrT\
        8X  dO   YI8  d!   \        P                  RYT	3,          4       R# YF8  d!   \        P                  RYT3,          4       TpT# T\        8X  dO   YH8  d!   \        P                  RYT3,          4       R# YG8  d!   \        P                  RYT3,          4       TpT# R#   \         d!    \        P                  R T,          4        R# i ; i)value '%s' is not integerNz/%s: max_freq_khz %d value below min_freq_khz %dzC%s: max_freq_khz %d value above initial_max_freq_khz - capped to %dz/%s: min_freq_khz %d value above max_freq_khz %dzC%s: min_freq_khz %d value below initial_max_freq_khz - capped to %d)r   
ValueErrorr   r*   r,   IS_MAXZinfoIS_MIN)
r   r+   
min_or_maxr    Zfreq_khzvaluesr$   r%   r&   r'   
   &&&&      r   _validate_khz_valueZ UncorePlugin._validate_khz_valueg   s   %j8
 == &^
MSJ|6II?6UaBbbc%HHRV\h|U}}~#H 
/ VII?6UaBbbc%HHRV\h|U}}~#H
 
/ 9 
 99(501
s   C 'DDc                s     \        V4      pT^ 8  g   T^d8  d   \        P                  RT,          4       R# T#   \         d!    \        P                  R T,          4        R# i ; i)r.   Nz/percent value '%s' is not within [0..100] range)r   r/   r   r*   )r   r    pcts   && r   _validate_percent_valueZ$UncorePlugin._validate_percent_value   s_    	U3
 	1Wc	99>FG
	* 
 99(501
s   ; 'A&%A&c                sF   \        V\        4      '       dy   VR,          R8X  dk   V P                  VP                  R4      4      pVf   R# V P	                  V4      pVf   R# Vw  rg pV\        WFV,
          ,          ^d,          4      ,           p	MTp	V P                  WV	4      # )r    Z%Ni)Z
isinstancer   r7   Zrstripr,   r   r5   )
r   r+   r2   r    r6   r3   r$   r%   Z_Zkhzr4   r   _validate_valueZUncorePlugin._validate_value   s    sb	S 0		%	%ell3&7	83	kMM&!6n8>51	CBV+V$WZ]$] ^	^3	3		!	!&c	::r   r&   T)Z
per_devicec                    V P                  V\        V4      pVf   R # V'       d   V# \        P                  RW&3,          4       V P	                  VRV4      # )Nz%s: set max_freq_khz %dr&   )r8   r0   r   r   r#   )r   r    r+   r   simremover&      &&&&&& r   _set_max_freq_khzZUncorePlugin._set_max_freq_khz   P    %%ffe<,

))%(>>?	6><	88r   c                &   V'       d,   \         P                  P                  \        4      '       g   R #  V P	                  VR4      p\        P                  RY3,          4       T#   \
        \        3 d    \        P                  R4        R # i ; i)Nr&   r(   z%s: get max_freq_khz %d
r   ZpathZisdirr	   r!   r
   r)   r   r*   r   )r   r+   r   ignore_missingr&   r"   r   _get_max_freq_khzZUncorePlugin._get_max_freq_khz   r    BGGMM)44
))FN3<
 ))%(>>?	 7	 9934
   A& &&BBr'   c                r9   )Nz%s: set min_freq_khz %dr'   )r8   r1   r   r   r#   )r   r    r+   r   r:   r;   r'   r<   r   _set_min_freq_khzZUncorePlugin._set_min_freq_khz   r>   r   c                r?   )Nr'   r(   z%s: get min_freq_khz %dr@   )r   r+   r   rA   r'   r"   r   _get_min_freq_khzZUncorePlugin._get_min_freq_khz   rC   rD   )r   r   r   r   N)F)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   r   r   r!   r#   r,   Zclassmethodr-   r5   r7   r8   Zcommand_setr=   Zcommand_getrB   rE   rF   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      s     24,'	R  !F;" n40	9 1	9 n  n40	9 1	9 n r   r   )Z r   Z
decoratorsZ
tuned.logsZtunedZtuned.utils.commandsr   r   r   ZlogsZgetr   r   r	   r1   r0   ZPluginr   r   r   r   <module>rG      sO       ) 	 jjnnj=		
	
I7>> Ir   