如何读取 PCIe 总线上使用的带宽?

发布于 2024-09-24 06:42:05 字数 516 浏览 13 评论 0原文

我正在开发一个流媒体应用程序,该应用程序在启动时将大量数据推送到显卡。当数据被推送时,CPU 几乎不做任何事情,它以接近零的使用率闲置。

我想监控哪些机器在推送初始数据方面遇到困难,哪些机器可以应付,以便我能够为客户硬件获得最低推荐规格。

我发现配备 PCIe 1.1 x16 插槽的 PC 很难将初始数据推送到显卡上。

我的开发 PC 有一个 PCIe 2.0 x16 插槽,它可以毫无问题地应对最初推送到显卡的大量数据。

我需要数字来证明(或反驳)我的观点。

我想要的是能够确定:

显卡位于哪种插槽类型? 该插槽的速度是多少? GFX卡名 Gfx 卡驱动程序版本

但最重要的是 PCIe 插槽上的数据流 - 例如,如果我可以表明 PCIe 总线的数据已达到最大,我可以指出这是瓶颈。

我知道系统内存速度也是一个因素,例如数据通过 PCIe 总线从 RAM 传输到显卡,那么有没有办法也确定系统内存速度?

最后,我使用非托管 C++ 编写,因此无法选择访问 .NET 库。

I'm working on a streaming media application that pushes a lot of data to the graphics card at startup. The CPU is doing very little at the point when the data is being pushed, it idles along at close to zero percent usage.

I'd like to monitor which machines struggle at pushing the initial data, and which ones can cope, in order that I can get to a minimum recommended spec for our customers hardware.

I've found that PCs with PCIe 1.1 x16 slots struggle with the initial data being pushed over the graphics card.

My development PC has a PCIe 2.0 x16 slot, and it has no problems with coping with the large amount of data being initially pushed to the graphics card.

I need numbers to prove (or disprove) my point.

What I'd like is to be able to determine:

Which slot type is the graphics card on?
What is the speed of that slot?
Gfx card name
Gfx card driver version

But most importantly, the data flow over the PCIe slot - e.g. if I can show that the PCIe bus is being maxed out with data, I can point to that as the bottle neck.

I know that system memory speed is also a factor here, e.g. the data is being transferred from RAM, over the PCIe bus to the graphics card, so is there a way to determine the system memory speed also?

Finally, I write in unmanaged C++, so accessing .NET libraries is not an option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

默嘫て 2024-10-01 06:42:05

对于 Nvidia GPU,您可以尝试使用 NvAPI_GPU_GetDynamicPstatesInfoEx

Nvidia 通过其 GeForce 驱动程序公开了一个编程接口
(“NVAPI”),除其他外,允许收集性能
测量。对于技术爱好者来说,这里是相关的
nvapi.h 头文件中的部分:

<块引用>

函数名称:NvAPI_GPU_GetDynamicPstatesInfoEx

描述:此 API 检索 NV_GPU_DYNAMIC_PSTATES_INFO_EX
指定物理 GPU 的结构。每个域的信息是
在数组中建立索引。例如:

  • pDynamicPstatesInfo->utilization[NVAPI_GPU_UTILIZATION_DOMAIN_GPU] 保存 GPU 域的信息。目前有四个域名
    GPU利用率和动态P状态阈值可以是
    检索到:图形引擎(GPU)、帧缓冲区(FB)、视频引擎
    (VID)和总线接口(BUS)。

除了这个标题注释之外,API 的具体功能并不
记录在案。以下信息是我们对其的最佳解读
工作原理,尽管它依赖于很多猜测。

  • 图形引擎(“GPU”)指标预计将成为大多数游戏的瓶颈。如果您没有看到 100% 或接近 100% 的情况,
    否则(例如您的 CPU 或内存子系统)会限制性能。
  • 帧缓冲区(“FB”)指标很有趣,如果它按预期工作的话。从名称来看,您可能会期望它测量图形内存
    利用率(已使用内存的百分比)。那不是这个,
    尽管。相反,它似乎是内存控制器的利用率
    以百分比表示。如果这是正确的,它将测量实际带宽
    由控制器使用,否则无法作为
    以任何其他方式测量。
  • 我们对视频引擎(“VID”)不那么感兴趣;它通常不用于游戏,并且通常记录为 0%。你会
    仅当您通过 ShadowPlay 编码视频或
    流式传输到盾牌。
  • 总线接口(“BUS”)指标是指 PCIe 控制器的利用率,同样以百分比表示。相应的测量,
    您可以在 EVGA PrecisionX 和 MSI Afterburner 中追踪,称为
    “GPU 总线使用情况”。

我们要求 Nvidia 透露一些 NVAPI 的内部工作原理。它是
响应确认 FB 指标测量图形内存
带宽使用情况,但 Nvidia 将 BUS 指标视为“被认为是
不可靠,因此不在内部使用”。

我们询问 AMD 是否有任何允许类似的 API 或函数
测量。经内部核实,公司代表
证实他们没有。只要我们愿意,我们就是
无法在AMD硬件上进行类似测试。

For Nvidia GPUs, you can try using NvAPI_GPU_GetDynamicPstatesInfoEx:

Nvidia, through its GeForce driver, exposes a programming interface
("NVAPI") that, among other things, allows for collecting performance
measurements. For the technically inclined, here is the relevant
section in the nvapi.h header file:

FUNCTION NAME: NvAPI_GPU_GetDynamicPstatesInfoEx

DESCRIPTION: This API retrieves the NV_GPU_DYNAMIC_PSTATES_INFO_EX
structure for the specified physical GPU. Each domain's info is
indexed in the array. For example:

  • pDynamicPstatesInfo->utilization[NVAPI_GPU_UTILIZATION_DOMAIN_GPU] holds the info for the GPU domain. There are currently four domains
    for which GPU utilization and dynamic P-state thresholds can be
    retrieved: graphic engine (GPU), frame buffer (FB), video engine
    (VID), and bus interface (BUS).

Beyond this header commentary, the API's specific functionality isn't
documented. The information below is our best interpretation of its
workings, though it relies on a lot of conjecture.

  • The graphics engine ("GPU") metric is expected to be your bottleneck in most games. If you don't see this at or close to 100%, something
    else (like your CPU or memory subsystem) is limiting performance.
  • The frame buffer ("FB") metric is interesting, if it works as intended. From the name, you'd expect it to measure graphics memory
    utilization (the percentage of memory used). That is not what this is,
    though. It appears, rather, to be the memory controller's utilization
    in percent. If that's correct, it would measure actual bandwidth being
    used by the controller, which is not otherwise available as a
    measurement any other way.
  • We're not as interested in the video engine ("VID"); it's not generally used in gaming, and registers a flat 0% typically. You'd
    only see the dial move if you're encoding video through ShadowPlay or
    streaming to a Shield.
  • The bus interface ("BUS") metric refers to utilization of the PCIe controller, again, as a percentage. The corresponding measurement,
    which you can trace in EVGA PrecisionX and MSI Afterburner, is called
    "GPU BUS Usage".

We asked Nvidia to shed some light on the inner workings of NVAPI. Its
response confirmed that the FB metric measures graphics memory
bandwidth usage, but Nvidia dismissed the BUS metric as "considered
to be unreliable and thus not used internally".

We asked AMD if it had any API or function that allowed for similar
measurements. After internal verification, company representatives
confirmed that they did not. As much as we would like to, we are
unable to conduct similar tests on AMD hardware.

自我难过 2024-10-01 06:42:05

您在推送大量数据时是否会遇到错误,或者您“只是”担心速度慢?

我怀疑是否有任何简单的方法可以监控 PCI-e 带宽使用情况(如果可能的话)。但应该可以通过 WMI 和/或 SetupAPI 查询视频适配器连接到的总线类型 - 抱歉,我没有个人经验或有用的链接。

Do you get errors pushing your massive amounts of data, or are you "simply" concerned with slow speed?

I doubt there's any easy way to monitor PCI-e bandwidth usage, if it's possible at all. But it should be possible to query the bus type the video adapter is connected to via WMI and/or SetupAPI - I have no personal experience or helpful links for either, sorry.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文