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 摘要。