§
    ÎÐjÂ  ã                  ó>   — d Z ddlmZ ddlZddlZdZdZdZdZd	d„Z	dS )
a–  Windows power throttling opt-out for the WanGP process.

Windows may run the processes of a minimized or background application at a reduced CPU speed (EcoQoS power throttling).
WanGP's main thread feeds the GPU, so a throttled CPU slows down the steps where the GPU waits for it, sometimes several
times. The opt-out is a per-process setting: it changes no system configuration and ends with the process.
é    )ÚannotationsNé   é   ÚreturnÚboolc            
     ó2  ‡— t           j        dk    rdS ddlmŠ  G ˆfd„dt          j        ¦  «        } t          j        dd¬	¦  «        }‰j        |j        _        ‰j        t          j	        t          j
        ‰j        g|j        _        ‰j        |j        _         | t          t           t"          z  d¦  «        }t%          |                     |                     ¦   «         t&          t          j        |¦  «        t          j        |¦  «        ¦  «        ¦  «        S )
ziAsks Windows not to throttle the CPU speed and timer resolution of this process; returns True if applied.ÚntFr   ©Úwintypesc                  óD   •— e Zd Zd” j        fd” j        fd” j        fgZdS )ú2prevent_power_throttling.<locals>._ThrottlingStateÚVersionÚControlMaskÚ	StateMaskN)Ú__name__Ú
__module__Ú__qualname__ÚULONGÚ_fields_r
   s   €úEC:\Users\johnn\OneDrive\Documents\AI\shared\utils\power_throttling.pyÚ_ThrottlingStater      s3   ø€ € € € € Ø ¤Ð/°-ÀÄÐ1PÐS^Ð`hÔ`nÐRoÐpˆˆˆó    r   Úkernel32T)Úuse_last_error)ÚosÚnameÚctypesr   Ú	StructureÚWinDLLÚHANDLEÚGetCurrentProcessÚrestypeÚc_intÚc_void_pÚDWORDÚSetProcessInformationÚargtypesÚBOOLÚ_THROTTLING_VERSIONÚ_EXECUTION_SPEEDÚ_IGNORE_TIMER_RESOLUTIONr   Ú_PROCESS_POWER_THROTTLINGÚbyrefÚsizeof)r   r   Ústater   s      @r   Úprevent_power_throttlingr0      s=  ø€ å	„w�$‚€ØˆuØÐÐÐÐÐðqð qð qð qð qð qð q�6Ô+ñ qô qð qõ Œ}˜Z¸Ð=Ñ=Ô=€HØ)1¬€HÔÔ&Ø/7¬ÅÄÍfÌoÐ_gÔ_mÐ.n€HÔ"Ô+Ø-5¬]€HÔ"Ô*ØÐÕ0Õ2BÕE]Ñ2]Ð_`ÑaÔa€EÝ�×.Ò.¨x×/IÒ/IÑ/KÔ/KÕMfÕhnÔhtÐuzÑh{Ôh{õ  ~Dô  ~Kð  LQñ  ~Rô  ~Rñ  Sô  Sñ  Tô  Tð  Tr   )r   r   )
Ú__doc__Ú
__future__r   r   r   r,   r)   r*   r+   r0   © r   r   ú<module>r4      sq   ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	àÐ ØÐ ØÐ ØÐ ðTð Tð Tð Tð Tð Tr   