diff --git a/src/com/sheepit/client/os/Windows.java b/src/com/sheepit/client/os/Windows.java index c1381b5..d5e5b56 100644 --- a/src/com/sheepit/client/os/Windows.java +++ b/src/com/sheepit/client/os/Windows.java @@ -139,10 +139,6 @@ public class Windows extends OS { else { wproc.setPriority(WinProcess.PRIORITY_BELOW_NORMAL); } - if (env != null) { - String cores = env.get("CORES"); - wproc.setAffinity(Integer.parseInt(cores)); - } return p; } diff --git a/src/com/sheepit/client/os/windows/Kernel32Lib.java b/src/com/sheepit/client/os/windows/Kernel32Lib.java index cb0c857..51a30d4 100644 --- a/src/com/sheepit/client/os/windows/Kernel32Lib.java +++ b/src/com/sheepit/client/os/windows/Kernel32Lib.java @@ -21,7 +21,6 @@ import com.sun.jna.Library; import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.platform.win32.BaseTSD; -import com.sun.jna.platform.win32.BaseTSD.DWORD_PTR; import com.sun.jna.platform.win32.WinDef; import com.sun.jna.platform.win32.WinDef.DWORD; import com.sun.jna.platform.win32.WinNT; @@ -212,13 +211,4 @@ public interface Kernel32Lib extends Library { */ public int SetErrorMode(DWORD uMode); - /** - * See : https://msdn.microsoft.com/en-us/library/windows/desktop/ms686247%28v=vs.85%29.aspx - * - * @param hThread - * @param dwThreadAffinityMask - * @return If the function succeeds, the return value is the thread's previous affinity mask. - */ - public boolean SetProcessAffinityMask(HANDLE hProcess, DWORD_PTR dwProcessAffinityMask); - } diff --git a/src/com/sheepit/client/os/windows/WinProcess.java b/src/com/sheepit/client/os/windows/WinProcess.java index f64b69b..1bb976d 100644 --- a/src/com/sheepit/client/os/windows/WinProcess.java +++ b/src/com/sheepit/client/os/windows/WinProcess.java @@ -26,7 +26,6 @@ import java.util.List; import com.sun.jna.Native; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.BaseTSD.DWORD_PTR; import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.Kernel32Util; import com.sun.jna.platform.win32.WinDef.DWORD; @@ -122,20 +121,6 @@ public class WinProcess { return this.kernel32lib.SetPriorityClass(this.handle, priority); } - public boolean setAffinity(int numberCores) { - // affects the process to a specific core/cpu, it will reduce the number of switch between core - // that way the machine will look "less busy" since default behavior for windows is to put 4 cores - // at 25% instead of 1 core at 100% but from the user point of view, it introduce lag. - if (numberCores > 0) { - long coreAffinity = 0; - for (int i = 0; i < numberCores; i++) { - coreAffinity |= 1L << i; - } - return this.kernel32lib.SetProcessAffinityMask(this.handle, new DWORD_PTR(coreAffinity)); - } - return false; - } - private void terminate() { Kernel32.INSTANCE.TerminateProcess(this.handle, 0); Kernel32.INSTANCE.CloseHandle(this.handle); // we are sure that the parent Process object is dead