You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/rake/cpu_counter.rb
+20-5Lines changed: 20 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -58,11 +58,20 @@ def count_via_java_runtime
58
58
end
59
59
60
60
def count_via_win32
61
-
require 'win32ole'
62
-
wmi = WIN32OLE.connect("winmgmts://")
63
-
cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # TODO count hyper-threaded in this
64
-
cpu.to_enum.first.NumberOfCores
65
-
rescue StandardError, LoadError
61
+
# Get-CimInstance introduced in PowerShell 3 or earlier: https://learn.microsoft.com/en-us/previous-versions/powershell/module/cimcmdlets/get-ciminstance?view=powershell-3.0
0 commit comments