Home Search Windows CE Perl Links Comments   jmk

* Win32::PerfLib History
* Performance Data Structure
* Win32::PerfLib Functions
* Win32::PerfLib Data Structure
* Performance Data Calculation
* Win32::PerfLib Sample Scripts
* Win32::PerfLib Tips and Tricks

 

Where to get Win32::PerfLib

Win32::PerfLib is included in libwin32-0.12. This version works only with the core distribution of perl.

A version for the ActiveState port build 316 is available on this site.

History

While writing a perl script to gather as much information as possible on remote computers, I needed to retrieve the system up time of remote computers. There is a tool called "srvinfo" in the Windows NT Server Resource Kit which displays the system up time among other system information, but since I've installed the service pack 3 and some hotfixes on my system, this tool crashes. So I've digged in the Win32 API documentation to find a way to get the information I want. I found the function GetTickCount(), but it wraps around zero after 49 days. I wasn't satisfied with this function. But in the documentation to GetTickCount was a note:

Windows NT: To obtain the time elapsed since the computer was started, look up the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value

So I try to retrieve the system up time with the Win32::Registry Module. The data I got back was binary data, which needed to be unpacked before use. Using the trial and error method I created the first script to retrieve the system up time. If you're willing to risk an eye: SystemUpTime_old.pl.

I wasn't very happy with this version although it works. But there are some more interesting counters: processes. So developed the perl extension Win32::PerfLib to get these informations.

There are two ways to access the performance data: the registry interface (HKEY_PERFORMANCE_DATA) and the performance data helper interface (PDH). The latter is a additional DLL from the Win32 SDK or the Windows NT Server Resource Kit. For Win32::PerfLib I used the registry interface.

 


Jutta M. Klebe