Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You may want to take a look at Scriptomatic 2.0 which is script generator:
use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("localhost"); foreach my $computer (@computers) { print "\n"; print "==========================================\n"; print "Computer: $computer\n"; print "==========================================\n"; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\ +root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Proce +ssor", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print "AddressWidth: $objItem->{AddressWidth}\n"; print "Architecture: $objItem->{Architecture}\n"; print "Availability: $objItem->{Availability}\n"; print "Caption: $objItem->{Caption}\n"; print "ConfigManagerErrorCode: $objItem->{ConfigManagerErrorCode +}\n"; print "ConfigManagerUserConfig: $objItem->{ConfigManagerUserConf +ig}\n"; print "CpuStatus: $objItem->{CpuStatus}\n"; print "CreationClassName: $objItem->{CreationClassName}\n"; print "CurrentClockSpeed: $objItem->{CurrentClockSpeed}\n"; print "CurrentVoltage: $objItem->{CurrentVoltage}\n"; print "DataWidth: $objItem->{DataWidth}\n"; print "Description: $objItem->{Description}\n"; print "DeviceID: $objItem->{DeviceID}\n"; print "ErrorCleared: $objItem->{ErrorCleared}\n"; print "ErrorDescription: $objItem->{ErrorDescription}\n"; print "ExtClock: $objItem->{ExtClock}\n"; print "Family: $objItem->{Family}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "L2CacheSize: $objItem->{L2CacheSize}\n"; print "L2CacheSpeed: $objItem->{L2CacheSpeed}\n"; print "LastErrorCode: $objItem->{LastErrorCode}\n"; print "Level: $objItem->{Level}\n"; print "LoadPercentage: $objItem->{LoadPercentage}\n"; print "Manufacturer: $objItem->{Manufacturer}\n"; print "MaxClockSpeed: $objItem->{MaxClockSpeed}\n"; print "Name: $objItem->{Name}\n"; print "OtherFamilyDescription: $objItem->{OtherFamilyDescription +}\n"; print "PNPDeviceID: $objItem->{PNPDeviceID}\n"; print "PowerManagementCapabilities: " . join(",", (in $objItem-> +{PowerManagementCapabilities})) . "\n"; print "PowerManagementSupported: $objItem->{PowerManagementSuppo +rted}\n"; print "ProcessorId: $objItem->{ProcessorId}\n"; print "ProcessorType: $objItem->{ProcessorType}\n"; print "Revision: $objItem->{Revision}\n"; print "Role: $objItem->{Role}\n"; print "SocketDesignation: $objItem->{SocketDesignation}\n"; print "Status: $objItem->{Status}\n"; print "StatusInfo: $objItem->{StatusInfo}\n"; print "Stepping: $objItem->{Stepping}\n"; print "SystemCreationClassName: $objItem->{SystemCreationClassNa +me}\n"; print "SystemName: $objItem->{SystemName}\n"; print "UniqueId: $objItem->{UniqueId}\n"; print "UpgradeMethod: $objItem->{UpgradeMethod}\n"; print "Version: $objItem->{Version}\n"; print "VoltageCaps: $objItem->{VoltageCaps}\n"; print "\n"; } }sub WMIDateStringToDate(strDate) { return "blah"; } __END__ STDOUT: C:\scripts>t.pl ========================================== Computer: localhost ========================================== AddressWidth: 32 Architecture: 0 Availability: 3 Caption: x86 Family 6 Model 6 Stepping 2 ConfigManagerErrorCode: ConfigManagerUserConfig: CpuStatus: 1 CreationClassName: Win32_Processor CurrentClockSpeed: 1607 CurrentVoltage: 18 DataWidth: 32 Description: x86 Family 6 Model 6 Stepping 2 DeviceID: CPU0 ErrorCleared: ErrorDescription: ExtClock: 133 Family: 29 InstallDate: L2CacheSize: 256 L2CacheSpeed: 535 LastErrorCode: Level: 6 LoadPercentage: 4 Manufacturer: AuthenticAMD MaxClockSpeed: 1607 Name: AMD Athlon(tm) XP 1900+ OtherFamilyDescription: PNPDeviceID: PowerManagementCapabilities: PowerManagementSupported: 0 ProcessorId: 0383FBFF00000662 ProcessorType: 3 Revision: 1538 Role: CPU SocketDesignation: Socket A Status: OK StatusInfo: 3 Stepping: 2 SystemCreationClassName: Win32_ComputerSystem SystemName: MOMULECHE UniqueId: UpgradeMethod: 14 Version: Model 6, Stepping 2 VoltageCaps:



In reply to Re: Finding CPU stats on Win32? by sh1tn
in thread Finding CPU stats on Win32? by guice

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-19 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found