Online-Admin.com |
 |
Menu |
 |
 |
Quick search |
 |
 |
New version notify |
 |
|
 |
TWmiPerformanceMonitor component |
 |
TWmiPerformanceMonitor is a part of
WmiSet Component Collection for Delphi, C++Builder.
It monitors the performance of various parts of Windows operating systems. It
uses WMI to provide access to the raw performance counters, and automatically
transforms the raw values into the displayable form.
The component has the following capabilities:
- List classes of performance counters installed on the destination computer. The examples of performance class are Memory, Processor, Cache etc.;
- List performance counters defined for each class. The examples of performance counters for "Memory" class are "Available MBytes", "Cache Bytes", "Page Faults/sec" etc.;
- Retrieve values of selected performance counters in both raw and cooked formats;
- Determine the state of AutoDiscovery/AutoPurge (ADAP) process, which transfers performance libraries into WMI classes;
|
|
Code Example: Measuring process's user time
|
This is a Delphi console application that shows the example how to
use TWmiPerformanceMonitor to obtain a percent of time that all the processes spend in user mode.
program performance_process_user_time;
{$APPTYPE CONSOLE}
uses
SysUtils, WmiPerformanceMonitor;
var
vMonitor: TWmiPerformanceMonitor;
vValue: TWmiPerfCounter;
begin
vMonitor := TWmiPerformanceMonitor.Create(nil);
try
vMonitor.Active := true;
vMonitor.PerfCounters.Add('Win32_PerfRawData_PerfProc_Process',
'PercentUserTime',
'_Total');
vValue := vMonitor.PerfCounters.Items[0];
while true do
begin
writeln(vValue.CounterDefinition.DisplayName, ' ', vValue.FormattedValue);
Sleep(1000);
end;
finally
vMonitor.Free;
end;
end.
|
|
GUI example.
|
WmiSet component collection comes with a demo project
that shows how to use TWmiPerformanceMonitor component in a GUI application. Look in the
examples\PerfMonitor directory. Click on the image do download
the demo application that can monitor various aspects of Windows operating systems
on a local or remote computer.
|
|