简体   繁体   English

Windows资源监视器使用哪个API?

[英]Which API does Windows Resource Monitor use?

Windows Resource Monitor displays (among other things) which files on disk are currently accessed by which processes. Windows资源监视器显示(除其他外)磁盘上的哪些文件当前由哪些进程访问。 And it does that in realtime. 它实时地做到了。 How? 怎么样?

I know that it probably uses ETW and that I can generate traces with tools like xperf. 我知道它可能使用ETW并且我可以使用像xperf这样的工具生成跟踪。 But how to get realtime information without having to start, stop and parse a trace file? 但是如何在不必启动,停止和解析跟踪文件的情况下获取实时信息?

I need to programmatically access the data, ie from C# or C++. 我需要以编程方式访问数据,即从C#或C ++。

w OpenTrace / ProcessTrace / StopTrace can get the data in real-time as long as you know the provider GUID. 只要您知道提供者GUID, OpenTrace / ProcessTrace / StopTrace就可以实时获取数据。 They can run on Win2000 but you need to parse the raw data in your callback functions. 它们可以在Win2000上运行,但您需要在回调函数中解析原始数据。 To convert raw data into human-readable text, we need the TMF/MOF. 要将原始数据转换为人类可读的文本,我们需要TMF / MOF。 Not sure if they are public though. 不确定它们是否公开。

For Vista/Win7, there is a new set of TDH (Trace Data Helper) APIs (eg: TdhFormatProperty). 对于Vista / Win7,有一组新的TDH(跟踪数据助手)API(例如:TdhFormatProperty)。 Scroll down a little of above links and you can see them. 向下滚动上面的一些链接,你可以看到它们。 The good thing about TDH is they can parse the data for you (still need to provide TDH the TMF/MOF though). TDH的好处是它们可以为您解析数据(尽管仍然需要为TDH提供TMF / MOF)。

I tried to write my own .etl to readable .txt program using Open/Process/StopTrace API (because I need to support XP). 我尝试使用Open / Process / StopTrace API将自己的.etl写入可读的.txt程序(因为我需要支持XP)。 I found out it's quite difficult. 我发现它很难。 The TMF file is not hard to interpret since it pure text. TMF文件不难解释,因为它是纯文本。 The hard thing is to decipher more than 50 different undocumented prinf-alike format-specifications' internal structures. 困难的是破译50多种不同的未记录的类似格式规范的内部结构。 So I gave up in the end and stick to the powerful tracefmt.exe provided in Microsoft WDK. 所以我最终放弃了并坚持使用Microsoft WDK中提供的强大的tracefmt.exe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM