找回密码
 加入
搜索
查看: 2863|回复: 5

[AU3基础] 【已解决】谁有PDH Performance Counters的ZIP压缩包下载呢

[复制链接]
发表于 2010-5-17 09:59:11 | 显示全部楼层 |阅读模式
本帖最后由 menfan 于 2010-5-19 09:34 编辑

谁有PDH Performance Counters的ZIP压缩包下载呢

PDH Performance Counters
About The Project:
Performance Counters gather all kind of performance data about the PC and the Network using the standard PDH.DLL module (standard since Windows 2000).
Among the performance data you can collect and monitor are:
•Processor Stats (including total usage)
•Process (programs) Stats (including CPU usage)
•Disk Stats (speed/access)
•TCP, UDP, IP Connection Counts, Speed/Error Stats
•Network Stats
•..and so on
Note that the examples and extended PDH modules are a WIP. Certain tests need to actually update/refresh the information, and other modifications are planned.
You can jump right in, download the two AutoIT files (below) and run one of the following to see what the PDH Performance Counters project can get you:
•TestPDH_PerformanceCounters - this is where you should start! It allows you to visually experiment with most all of the Counters available on your PC and Network.
NOTES:
- Currently the 'Refresh' rate is set to 1/2 second - this can be changed by altering the Adlib() function frequency
- New Counters that come into existence during monitoring will *not* be added to the list (this would be a function I've yet to add)
- Counters that become invalid are simply given a prefix of '[Dead Counter Handle]:'
•TestPDH_Multi - this basically repeatedly shows an extended Process-information list for all processes. NOTE: You must hit 'ESC' to exit the loop
•TestPDH_TaskManager - this gathers and displays most everything you'd see in the Process and Performance sections of Task Manager.
NOTES:
- The screen does NOT update, and the initial %'s will be incorrect. This is due to a number of reasons - the biggest one being laziness on my behalf. (me and listview add/removals don't get along just yet)
- TWO fields need Windows XP+ to display correctly (or a version of psapi.dll that supports 'GetPerformanceInfo'): Commit Charge (Peak) and System Cache
•TestPDH_ProcessGetRelatives - this shows how the PDH Performance Counters can be used to get 'parent' and 'children' process information. There are more practical means of getting this info of course (a few you'll see in my 'Process Functions' module (yet to be released), but hey - its just yet another example of what can be done.
So here's a quick run-down about the PDH process (all of this is managed through my functions):
1.The 2 registry locations that can disable performance counters are checked and changed if they are set to disabled. This unfortunately requires access to the HKLM branch of the registry. (Though I'm not quite sure on how many people's PC's this data is Disabled) [Part of 'Init() function]
2.The PDH.DLL is Opened with DLLOpen - otherwise Handles will become invalid after acquiring them. [Part of Init() function].
PDH.DLL will in turn generate a file in your @TempDir (%temp%) named something like 'Perflib_Perfdata_xxx.dat' which will probably be ~16KB. It needs this file to monitor data.
3.The Counter Path must be obtained (unless it is known beforehand). Wildcards are possible in paths, and there are functions to translate these into an array of full paths (a bit too many functions as of now). Also, the 'Browse Counters' dialog box can be opened and used to obtain a full path (or wildcard one)
4.A PDH Query Handle has to be obtained [GetNewQueryHandle() function]
5.PDH Counter Handles need to be added to the PDH Query Handle - using path(s) obtained in step 3 [AddCounter() or AddCountersByArray() function]
6.PDH Counters need to be queried and the values formatted into numerical data [UpdateCounters() function]
7.You can do whatever you want with it from here - and continue to requery the Counter values for as long as needed
8.When done with a PDH Query Handle, it should be released [FreeQueryHandle() function]
9.When counters are no longer needed, the PDH.DLL can be closed [Part of UnInit() function]. This deletes the temporary 'Perflib..' file as well.
10.The Regisry keys can be reset (if they were changed to allow Performance Data collection) [Part of UnInit() function]
All in all, this was/is a huge project. Any feedback is welcome. I apologize for the unpolished GUI interface, need for cleanup, and completion of a few things, but I'm releasing it so that everyone can again experience the power of Performance Counters :lmao:
NOTE: Bundled in the ZIP (and included in the License agreement) are other UDF's I wrote that are necessary to run some of the 'Test' programs:
_WinAPI_GetSystemInfo.au3, _WinAPI_GetPerformanceInfo.au3, _WinTimeFunctions.au3, and the unnecessary, but provided for those who are interested in the _WinTimeFunctions 'filetime' usage, program: TestWinTimeFunctions.au3.
New:
!! CPU Usage now reports correct % (based on comparisons with Task Manager)!!
New functionality:
TEST_PDH_PerformanceCounters now allows Manual entry for more experimentation
Added functions:
_PDH_RemoveCounter()
_PDH_UpdateCounter()
Also added from another UDF (just to keep file count down):
_WinAPI_GetSystemInfo() - for CPU count
Altered functions:
PDH_Init() now initializes CPU totals
PDH_UpdateCounters() changed to test for CPU usage Counters and adjust according to # of CPU's
(PDH_UpdateCounter() has the same functionality)
_PDH_AddCountersByArray() altered slightly in that the 'bottom rows' parameter is a count rather than a bool.
- *misc* other changes
 楼主| 发表于 2010-5-17 10:00:36 | 显示全部楼层
正需要这个哦,有的话麻烦共享一下吧呵呵
发表于 2010-5-17 10:17:35 | 显示全部楼层
果真无聊啊~ 你回帖前都不看下主题是什么内容的吗?
 楼主| 发表于 2010-5-17 10:47:50 | 显示全部楼层
没注意看,要的就是这一块:Among the performance data you can collect and monitor are:
•Processor Stats (including total usage)
•Process (programs) Stats (including CPU usage)
•Disk Stats (speed/access)
•TCP, UDP, IP Connection Counts, Speed/Error Stats
•Network Stats
•..and so on
 楼主| 发表于 2010-5-17 10:50:55 | 显示全部楼层
和这个的http://www.autoitx.com/forum.php ... 4441&highlight=类似吧,不过我要的是官网上下载的呵呵
发表于 2010-5-17 15:00:16 | 显示全部楼层
UDF区的pdh.au3同样可以实现以上的功能,无非就是计数器路径的区别。
当初在编写pdh.au3的时候,是准备细致到获取CPU、进程、磁盘等对象的统计数据的,但代码都是千篇一律的,只要知道计数器路径,那么照葫芦画瓢,任何统计都能够获取到。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-6 11:26 , Processed in 0.089812 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表