Possible bug in `DynamicQuerySample` / `AddGpuMetric`

未关闭 适合新手
#684 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
80/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
documentation

调研方向

该改动是在 DynamicQuerySample 的 AddGpuMetric() 函数中的一行编辑:第四个 Presented FPS 元素推送 PM_STAT_PERCENTILE_90,而 print 语句将其标记为 99%,因此该 stat 应改为 PM_STAT_PERCENTILE_99。对照 DynamicQuerySample() 中已经正确使用 PM_STAT_PERCENTILE_99 的 FixedQueryElement fps99 进行交叉检查。当 elements[4] 与其 "Presented FPS 99%" 标签匹配,且示例仍能构建并运行时,即完成。由于该 issue 是以问题形式提出的,开始前可能需要维护者的确认。

由索引模型根据 Issue 内容生成。

描述

Possible bug in DynamicQuerySample / AddGpuMetric

I noticed what appears to be a typo in the AddGpuMetric() function of the Dynamic Query sample.

The code adds the fourth FPS percentile query as:

elements.push_back(PM_QUERY_ELEMENT{
    .metric = PM_METRIC_PRESENTED_FPS,
    .stat = PM_STAT_PERCENTILE_90,
    .deviceId = 0,
    .arrayIndex = 0
});

However, the corresponding output is labeled:

ConsolePrintLn("Presented FPS 99% = %f",
    *reinterpret_cast<const double*>(&pBlob[elements[4].dataOffset]));

Therefore, the output labeled Presented FPS 99% actually contains the 90th percentile value.

I believe this should be:

elements.push_back(PM_QUERY_ELEMENT{
    .metric = PM_METRIC_PRESENTED_FPS,
    .stat = PM_STAT_PERCENTILE_99,
    .deviceId = 0,
    .arrayIndex = 0
});

The same logic is already used correctly in the DynamicQuerySample() fixed query:

FixedQueryElement fps99{
    this,
    PM_METRIC_PRESENTED_FPS,
    PM_STAT_PERCENTILE_99
};

So it looks like the AddGpuMetric() version may simply contain a copy/paste typo.

Could you please confirm whether this is an unintended error in the sample?

Thanks!

主要语言
C++
星标
2.6k
派生
201
平均合并
2 天 21 小时
30 天内合并 PR
16

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

GameTechDev/PresentMon 的其他 Issue

查看 GameTechDev/PresentMon 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。