Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How many cores does my processor have?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
carlos_m_gil_p
898 Views, 5 Replies

How many cores does my processor have?

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.


AutoCAD 2025
Visual Studio Code 1.87.2
AutoCAD AutoLISP Extension 1.6.2

5 REPLIES 5
Message 2 of 6
braudpat
in reply to: carlos_m_gil_p

Hello

As far as I know this technical Info can't be retrieve from Lisp !?

Regards, Patrice
Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 3 of 6
ronjonp
in reply to: braudpat


@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) )
Message 4 of 6
braudpat
in reply to: ronjonp

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 ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 5 of 6
carlos_m_gil_p
in reply to: ronjonp

Hi @ronjonp

Thank you very much for your help.

It works perfect.
A greeting.


AutoCAD 2025
Visual Studio Code 1.87.2
AutoCAD AutoLISP Extension 1.6.2

Message 6 of 6
vladimir_michl
in reply to: braudpat

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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost