Author Topic: Get CPU information  (Read 1928 times)

0 Members and 1 Guest are viewing this topic.

yarik

  • Newt
  • Posts: 32
Get CPU information
« on: November 25, 2010, 05:07:17 PM »
This is my first contribution
Here`s a little function to get information from CPU (Processor) through Lisp


Code: [Select]


;;;
;;;class Win32_Processor : CIM_Processor
;;;{
;;;  uint16   AddressWidth;
;;;  uint16   Architecture;
;;;  uint16   Availability;
;;;  string   Caption;
;;;  uint32   ConfigManagerErrorCode;
;;;  boolean  ConfigManagerUserConfig;
;;;  uint16   CpuStatus;
;;;  string   CreationClassName;
;;;  uint32   CurrentClockSpeed;
;;;  uint16   CurrentVoltage;
;;;  uint16   DataWidth;
;;;  string   Description;
;;;  string   DeviceID;
;;;  boolean  ErrorCleared;
;;;  string   ErrorDescription;
;;;  uint32   ExtClock;
;;;  uint16   Family;
;;;  datetime InstallDate;
;;;  uint32   L2CacheSize;
;;;  uint32   L2CacheSpeed;
;;;  uint32   L3CacheSize;
;;;  uint32   L3CacheSpeed;
;;;  uint32   LastErrorCode;
;;;  uint16   Level;
;;;  uint16   LoadPercentage;
;;;  string   Manufacturer;
;;;  uint32   MaxClockSpeed;
;;;  string   Name;
;;;  uint32   NumberOfCores;
;;;  uint32   NumberOfLogicalProcessors;
;;;  string   OtherFamilyDescription;
;;;  string   PNPDeviceID;
;;;  uint16   PowerManagementCapabilities[];
;;;  boolean  PowerManagementSupported;
;;;  string   ProcessorId;
;;;  uint16   ProcessorType;
;;;  uint16   Revision;
;;;  string   Role;
;;;  string   SocketDesignation;
;;;  string   Status;
;;;  uint16   StatusInfo;
;;;  string   Stepping;
;;;  string   SystemCreationClassName;
;;;  string   SystemName;
;;;  string   UniqueId;
;;;  uint16   UpgradeMethod;
;;;  string   Version;
;;;  uint32   VoltageCaps;
;;;};





(defun Getid (/ mac WMIobj serv lox sn)
  (vl-load-com)
  (setq mac '())
  (if (setq WMIobj (vlax-create-object "wbemScripting.SwbemLocator"))
    (progn
      (SETQ serv (vlax-invoke
                   WMIobj
                   "ConnectServer"
                 )
      )
      (setq lox (vlax-invoke
                  serv
                  'ExecQuery
                  "SELECT * FROM Win32_processor"
                )
      )
      (vlax-for item lox
        (if
          (not
            (member (setq sn (vlax-get item 'name)) mac)
          )
           (setq mac (cons sn mac))
        )
      )
      (mapcar 'vlax-release-object (list lox serv WMIobj))
    )
  )
  mac
)
« Last Edit: November 25, 2010, 05:28:45 PM by yarik »