System.Machine.CPU.usagePercentage Property

Gets the percentage of a microprocessor's capacity being used.

This property is read-only.

Syntax

propVal = System.Machine.CPU.usagePercentage()

  

Parameters

  • fltCPUConsumed [out]
    Retrieves the percentage of CPU capacity being used.

Remarks

Individual CPU details are accessible through the CPUs collection of System.Machine.

Examples

The following example demonstrates how to access a CPU in the CPUs collection and get a specific property for that CPU.

// --------------------------------------------------------------------
// Initialize the gadget.
// --------------------------------------------------------------------
function Init()
{
    // Get the machine details.
    sMachineInfo += "Processor Architecture: " + System.Machine.processorArchitecture + "<br/>";
    sMachineInfo += "Total Memory: " + System.Machine.totalMemory + "<br/>";
    sMachineInfo += "Available Memory: " + System.Machine.availableMemory + "<br/>";
    
    // Get the collection of folders from Windows Mail.
    collCPUs = System.Machine.CPUs;

    // Report the folder details.
    for (var loop = 0; loop < collCPUs.count; loop++)
    {
        oCPU = collCPUs.item(loop);
        sMachineInfo += '<span id="CPU' + 
            loop + '">' + oCPU.name + ':' + oCPU.usagePercentage + '%</span><br/>';
    }    
    
    // Initialize the gadget content.
    SetContentText();
}

Requirements

Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
IDL Sidebar.idl
DLL Sidebar.Exe version 1.00 or later

See Also

System.Machine.CPU

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK