DISK_PERFORMANCE 结构体的 ReadTime 和 WriteTime 成员
我正在尝试剖析 DISK_PERFORMANCE 结构,但似乎找不到任何像样的文档。有谁知道ReadTime和WriteTime成员是什么意思?
MSDN 声称“完成读/写所需的时间”,但是读/写什么?还有它是用什么来衡量的?
I'm trying to disect the DISK_PERFORMANCE struct but can't seem to find any decent documentation. Does anyone know what the ReadTime and WriteTime members mean?
The MSDN claims, "The time it takes to complete a read/write", but the read/write of what? Also what is it measured in?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新:我不知道,但现在我知道了。
我不熟悉 DISK_PERFORMANCE,但熟悉 HKEY_PERFORMANCE_DATA 性能数据。
平均。磁盘秒/读取计数器报告每次读取的平均时间(还有另一个用于写入的计数器)。此计数器的类型为 PERF_AVERAGE_TIMER 类型。你实际得到的数据是读取所花费的总时间和操作的总数。您获取两个样本并减去这些值即可得到样本间隔期间读取所花费的总时间以及样本间隔期间的操作总数。然后将这两个值相除即可得到每次读取的平均时间。
时钟频率也会与性能数据一起返回,因此您可以将时间单位转换为秒。
假设 DISK_PERFORMANCE 的工作原理类似,那么 ReadTime 和 WriteTime 将是所有读取和写入所花费的总时间。不幸的是,它使用的时钟频率并不明显,但它很可能使用 查询性能频率。我会尝试一下,看看结果(平均读写时间)是否与您在 perfmon 中看到的值进行比较。
头文件 (winioctl.h) 不包含太多有用的信息,但它确实表示 IOCTL_DISK_PERFORMANCE 请求被转发到 DISKPERF 筛选器驱动程序或 SIMBAD 筛选器驱动程序(模拟磁盘故障)。这意味着您应该在不同的设备类型上获得一致的结果。
更新
所以我做了研究。一些示例数据:
每行都有 DISK_PERFORMANCE 中的 ReadTime 和 ReadCount 成员的增量(每秒采样一次),后跟 HKEY_PERFORMANCE_DATA 中的相应值,然后是第一个 ReadTime 除以第二个。
HKEY_PERFORMANCE_DATA 值以 QueryPerformanceFrequency 为单位,在我的 PC 上为 2240517Hz。 10,000,000 / 2240517 = 4.4633 因此 DISK_PERFORMANCE 指标似乎以 100ns (=10MHz) 为单位。
重申一下,DISK_PERFORMANCE::ReadTime 是以 100ns 为单位的读取所花费的总时间。
Update: I didn't know, but I do now.
I wasn't familiar with DISK_PERFORMANCE but I am familiar with the HKEY_PERFORMANCE_DATA performance data.
The Avg. Disk sec/Read counter reports the average time per read (and there's another counter for writes). This counter has the PERF_AVERAGE_TIMER type. The data that you actually get is the total time spent reading and the total number of operations. You acquire two samples and subtract the values to get the total time spent reading during the sample interval and the total number of operations during the sample interval. You then divide these two values to get the avarage time per read.
The clock frequency is also returned along with the performance data so you can convert the time units to seconds.
Assuming that DISK_PERFORMANCE works similarly then ReadTime and WriteTime will be the total time spent on all reads and writes. Unfortunately, it's not obvious what clock frequency it's using, but it's most likely using the value from QueryPerformanceFrequency. I'd try that and see if the results (for average read and write time) compare to the values you see in perfmon.
The header file (winioctl.h) doesn't contain much useful information, but it does say that the IOCTL_DISK_PERFORMANCE request is forwarded to either the DISKPERF filter driver or the SIMBAD filter driver (which simulates disk faults). Which means you should get consistent results across different device types.
Update
So I did the research. Some sample data:
Each line has the deltas of the ReadTime and ReadCount members from DISK_PERFORMANCE (sampled once per second) followed by the corresponding values from HKEY_PERFORMANCE_DATA, followed by the first ReadTime divided by the second.
The HKEY_PERFORMANCE_DATA values are in QueryPerformanceFrequency units, 2240517Hz on my PC. 10,000,000 / 2240517 = 4.4633 so the DISK_PERFORMANCE metrics seem to be in 100ns (=10MHz) units.
To reiterate, DISK_PERFORMANCE::ReadTime is the total time spend on reads in 100ns units.
一般来说,与所有 DeviceIOControl 一样,它意味着底层驱动程序的含义。您可以从
StorageManagerName
成员中推断出,有多个驱动程序使用此结构。In general, like all DeviceIOControl's, it means whatever the underlying driver means. As you can deduce from the
StorageManagerName
member, there are multiple drivers that use this struct.