Skip to content

Commit

Permalink
feat: do not use idle disable when hyper threading is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyueta committed Aug 8, 2023
1 parent 5685fe2 commit f2578f5
Showing 1 changed file with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
@echo off
setlocal EnableDelayedExpansion

whoami /user | find /i "S-1-5-18" > nul 2>&1 || (
call RunAsTI.cmd "%~f0" "%*"
exit /b

:: Check if hyper threading is enabled
for /f "tokens=2 delims==" %%a in ('wmic cpu get NumberOfCores /value') do set PHYSICAL_CORES=%%a
for /f "tokens=2 delims==" %%a in ('wmic cpu get NumberOfLogicalProcessors /value') do set LOGICAL_CORES=%%a

if "%LOGICAL_CORES%" GTR "%PHYSICAL_CORES%" (
call :hyperThreading
)

echo THIS WILL CAUSE YOUR CPU USAGE TO *DISPLAY* AS 100% IN TASK MANAGER. ENABLE IDLE IF THIS IS AN ISSUE.
echo This will make your Task Manager display CPU usage as 100% (visual bug). It does not occur in Process Explorer.
powercfg /setacvalueindex scheme_current sub_processor 5d76a2ca-e8c0-402f-a133-2158492d58ad 1
powercfg /setactive scheme_current

echo Finished, changes have been applied.
pause
exit /b
exit /b

:hyperThreading
mode con: cols=46 lines=14
chcp 65001 > nul
echo]
echo  Hyper Threading Detected
echo ──────────────────────────────────────────
echo Detected Hyper Threading feature enabled.
echo]
echo You should not disable idle states when
echo this feature is enabled as it makes
echo the single-threaded performance worse.
echo]
echo It can be disabled by using BIOS or GRUB.
echo]
echo Press any key to exit... [?25l
pause > nul
exit /b 1

0 comments on commit f2578f5

Please sign in to comment.