如何对硬件性能计数器进行编程
我的论文一直在处理这个问题。 目标是开发一款专门针对windows 2K8服务器的.net服务器监控工具。 到目前为止,我只能访问软件性能计数器。 指的是通过 perfmon 和 WMI 类可用的那些。
但还有一个问题是,我需要能够监控发生的 TLB 未命中次数或当前内存带宽等情况。 这就是我被困住的地方...... 由于没有标准的 .net 方法来获取这些计数器,我一直在阅读 Oprofile 等开源程序的一些代码。 但由于我不知道我到底在寻找什么,因此在这方面没有取得太大进展。
所以我虚心地询问这里是否有人有这方面的经验并且可以帮助我一些。
提前致谢。
I've been dealing with this problem for my thesis.
The goal is to develop a .net server monitoring tool specifically for windows 2K8 servers.
So far, all I can access are software performance counters. Meaning those that are available through perfmon and the WMI classes.
But then there's also the issue that I need to be able to monitor things like the number of TLB-misses that occur, or the current memory bandwidth. And that's where I'm stuck...
As there is no standard .net way to get these counters I've been reading through some code from open source programs such as Oprofile. But since I don't know what exactly I'm looking for, not much progress has been made on that front.
So I humbly ask if there is somebody here, who has any experience with this kind of thing and could help me out a bit.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最广泛使用的读取性能计数器的库是性能 API (PAPI)。 PAPI 实际上是两个 API(高级 和低级)。 我倾向于使用低级别的,因为我发现它更直观,但这可能只是我的情况。
PAPI 中有两种类型的事件。 预设事件应该与平台无关,尽管它们可能会根据内部计数方式而略有不同。 它们确实包括 TLB 未命中和内存停顿,所以也许您可以从这里开始。 如果这不满足您的需求,您可能需要查看本机事件,这些事件特定于您的特定硬件,通常包括硬件可以计数的每个事件。 使用
papi_native_aval
获取这些列表。PAPI支持Windows,但我实际上从未尝试过。 我在文档/自述文件中找不到任何专门提到 Windows 2008 的内容,但至少您可以查看源代码以了解如何访问您需要的计数器,即使您无法直接访问它们。
如果您需要更多信息,那么可以看看 perfmon2,较新版本的 PAPI 在Linux,如果有的话。
The most widely used library for reading performance counters is the Performance API (PAPI). PAPI is actually two API's (high-level and low-level). I tend to use the low level one since I find it more intuitive, but that could just be me.
There are two types of events in PAPI. Preset events are supposed to be platform-agnostic, though they can differ subtly depending on how they're counted internally. They do include TLB misses and memory stalls, so maybe you could start there. If that doesn't suit your needs, you may want to have a look at native events, which are specific to your particular hardware and typically include every event that the hardware can count. Use
papi_native_aval
to get a list of these.PAPI has support for Windows, but I've actually never tried it. I couldn't find anything in the docs/readmes that referred specifically to Windows 2008, but at the very least perhaps you can look through the source to see how to access the counters you need, even if you can't access them directly.
If you need more, then maybe take a look at perfmon2, which the newer versions of PAPI make use of on Linux, if it's available.