Hello boys how are you.
Someone will know if there is any variable or a lisp, to know how many cores my processor has.
Thank you.
Solved! Go to Solution.
Solved by ronjonp. Go to Solution.
Patrice BRAUD
@braudpat wrote:
Hello
As far as I know this technical Info can't be retrieve from Lisp !?
Regards, Patrice
I would think this could be done using WMI ?
Yup 🙂
(defun _wmi (device / m1 m2 r s wmi) (cond ((and (setq wmi (vlax-create-object "WbemScripting.SWbemLocator")) (setq m1 (vlax-invoke wmi 'connectserver "." "\\root\\cimv2")) (setq m2 (vlax-invoke m1 'execquery device)) ) (setq r (car (vlax-for i m2 (setq s (cons i s))))) (vlax-release-object wmi) r ) ) ) (defun _get (/ a l p) (if (setq a (_wmi "SELECT * FROM Win32_Processor")) (vlax-for x (vlax-get a "Properties_") (and (setq p (vlax-get x 'value)) (setq l (cons (cons (vlax-get x 'name) p) l))) ) ) (reverse l) ) (setq r (_get))
;; This line to get cores (cdr (assoc "NumberOfCores" r)) ;; Results (("VMMonitorModeExtensions" . -1) ("VirtualizationFirmwareEnabled" . 0) ("Version" . "") ("UpgradeMethod" . 50) ("ThreadCount" . 12) ("SystemName" . "ScoobyDoo") ("SystemCreationClassName" . "Win32_ComputerSystem") ("StatusInfo" . 3) ("Status" . "OK") ("SocketDesignation" . "LGA1151") ("SerialNumber" . "To Be Filled By O.E.M.") ("SecondLevelAddressTranslationExtensions" . -1) ("Role" . "CPU") ("ProcessorType" . 3) ("ProcessorId" . "bbbzzzbbzbzzzz") ("PowerManagementSupported" . 0) ("PartNumber" . "To Be Filled By O.E.M.") ("NumberOfLogicalProcessors" . 12) ("NumberOfEnabledCore" . 6) ("NumberOfCores" . 6) ("Name" . "Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz") ("MaxClockSpeed" . 3696) ("Manufacturer" . "GenuineIntel") ("LoadPercentage" . 1) ("Level" . 6) ("L3CacheSpeed" . 0) ("L3CacheSize" . 12288) ("L2CacheSize" . 1536) ("Family" . 198) ("ExtClock" . 100) ("DeviceID" . "CPU0") ("Description" . "Intel64 Family 6 Model 158 Stepping 10") ("DataWidth" . 64) ("CurrentVoltage" . 10) ("CurrentClockSpeed" . 3696) ("CreationClassName" . "Win32_Processor") ("CpuStatus" . 1) ("Characteristics" . 252) ("Caption" . "Intel64 Family 6 Model 158 Stepping 10") ("Availability" . 3) ("AssetTag" . "To Be Filled By O.E.M.") ("Architecture" . 9) ("AddressWidth" . 64) )
Hello @ronjonp
Beautiful ! ... Visual Lisp + WMI is the solution !!
Regards, Patrice
PS: Is it possible to know from VLisp+WMI that the ACAD.exe is running into a VMWare ??
Patrice BRAUD
Yes, a VMware check should be possible using this method as well. Just query the Win32_BIOS or Win32_ComputerSystem objects:
(_wmi "SELECT * FROM Win32_BIOS")
(_wmi "SELECT * FROM Win32_ComputerSystem")
Vladimir Michl, www.cadstudio.cz - www.cadforum.cz