|
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.
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:
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.
|