Skip to content

Commit 87fde8a

Browse files
Merge pull request #44 from intel-innersource/docs/md-updates
Docs/md updates
2 parents 60e77a2 + 47660e0 commit 87fde8a

17 files changed

+230
-152
lines changed

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Note: if you only want to build the PresentData/ library, or the PresentMon Cons
2626
2727
2. Build the Chromium Embedded Framework (CEF)
2828
29-
1. Download the CEF 114.2.11 distribution and extract it to a local folder (e.g., CefDir): https://cef-builds.spotifycdn.com/index.html
29+
1. Download the CEF 122.1.13 distribution and extract it to a local folder (e.g., CefDir): https://cef-builds.spotifycdn.com/index.html
3030
3131
- The "Minimal Distribution" is sufficient.
3232

IntelPresentMon/AppCef/Web/BlockLists/TargetBlockList.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ wowup.exe
295295
wpfsurface.exe
296296
wsl2distromanager.exe
297297
wudfhost.exe
298-
wwahostexe
298+
wwahost.exe
299+
xboxgamebarwidgets.exe
299300
xboxapp.exe
300301
xboxpcapp.exe
301302
xdesproc.exe

IntelPresentMon/Core/Core.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
<ClInclude Include="source\pmon\DynamicQuery.h" />
9595
<ClInclude Include="source\pmon\metric\DynamicPollingFetcher.h" />
9696
<ClInclude Include="source\pmon\MetricFetcherFactory.h" />
97+
<ClInclude Include="source\pmon\RawFrameDataMetricList.h" />
9798
<ClInclude Include="source\pmon\StatisticsTracker.h" />
9899
<ClInclude Include="source\win\com\ProcessSpawnSink.h" />
99100
<ClInclude Include="source\kernel\KernelHandler.h" />

IntelPresentMon/Core/Core.vcxproj.filters

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
<ClInclude Include="source\kernel\DataFetchPack.h" />
125125
<ClInclude Include="source\pmon\MetricFetcherFactory.h" />
126126
<ClInclude Include="source\kernel\MetricPackMapper.h" />
127+
<ClInclude Include="source\pmon\RawFrameDataMetricList.h" />
127128
</ItemGroup>
128129
<ItemGroup>
129130
<ClCompile Include="source\win\MessageMap.cpp" />
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#pragma once
2+
// must include PresentMonAPI.h before including this file
3+
#include <optional>
4+
#include <cstdint>
5+
#include <vector>
6+
#include <ranges>
7+
8+
namespace p2c::pmon
9+
{
10+
struct RawFrameQueryElementDefinition
11+
{
12+
PM_METRIC metricId;
13+
uint32_t deviceId;
14+
std::optional<uint32_t> index;
15+
};
16+
17+
inline std::vector<RawFrameQueryElementDefinition> GetRawFrameDataMetricList(uint32_t activeDeviceId)
18+
{
19+
namespace rn = std::ranges;
20+
using Element = RawFrameQueryElementDefinition;
21+
22+
std::vector<Element> queryElements{
23+
Element{.metricId = PM_METRIC_TIME, .deviceId = 0 },
24+
Element{.metricId = PM_METRIC_SWAP_CHAIN_ADDRESS, .deviceId = 0 },
25+
Element{.metricId = PM_METRIC_PRESENT_RUNTIME, .deviceId = 0 },
26+
Element{.metricId = PM_METRIC_SYNC_INTERVAL, .deviceId = 0 },
27+
Element{.metricId = PM_METRIC_PRESENT_FLAGS, .deviceId = 0 },
28+
Element{.metricId = PM_METRIC_ALLOWS_TEARING, .deviceId = 0 },
29+
Element{.metricId = PM_METRIC_PRESENT_MODE, .deviceId = 0 },
30+
Element{.metricId = PM_METRIC_CPU_FRAME_QPC, .deviceId = 0 },
31+
Element{.metricId = PM_METRIC_FRAME_TIME, .deviceId = 0 },
32+
Element{.metricId = PM_METRIC_CPU_BUSY, .deviceId = 0 },
33+
Element{.metricId = PM_METRIC_CPU_WAIT, .deviceId = 0 },
34+
Element{.metricId = PM_METRIC_GPU_LATENCY, .deviceId = 0 },
35+
Element{.metricId = PM_METRIC_GPU_TIME, .deviceId = 0 },
36+
Element{.metricId = PM_METRIC_GPU_BUSY, .deviceId = 0 },
37+
Element{.metricId = PM_METRIC_GPU_WAIT, .deviceId = 0 },
38+
Element{.metricId = PM_METRIC_DISPLAY_LATENCY, .deviceId = 0 },
39+
Element{.metricId = PM_METRIC_DISPLAYED_TIME, .deviceId = 0 },
40+
Element{.metricId = PM_METRIC_CLICK_TO_PHOTON_LATENCY, .deviceId = 0 },
41+
42+
Element{.metricId = PM_METRIC_GPU_POWER, .deviceId = activeDeviceId },
43+
Element{.metricId = PM_METRIC_GPU_VOLTAGE, .deviceId = activeDeviceId },
44+
Element{.metricId = PM_METRIC_GPU_FREQUENCY, .deviceId = activeDeviceId },
45+
Element{.metricId = PM_METRIC_GPU_TEMPERATURE, .deviceId = activeDeviceId },
46+
Element{.metricId = PM_METRIC_GPU_UTILIZATION, .deviceId = activeDeviceId },
47+
Element{.metricId = PM_METRIC_GPU_RENDER_COMPUTE_UTILIZATION, .deviceId = activeDeviceId },
48+
Element{.metricId = PM_METRIC_GPU_MEDIA_UTILIZATION, .deviceId = activeDeviceId },
49+
Element{.metricId = PM_METRIC_GPU_MEM_POWER, .deviceId = activeDeviceId },
50+
Element{.metricId = PM_METRIC_GPU_MEM_VOLTAGE, .deviceId = activeDeviceId },
51+
Element{.metricId = PM_METRIC_GPU_MEM_FREQUENCY, .deviceId = activeDeviceId },
52+
Element{.metricId = PM_METRIC_GPU_MEM_EFFECTIVE_FREQUENCY, .deviceId = activeDeviceId },
53+
Element{.metricId = PM_METRIC_GPU_MEM_TEMPERATURE, .deviceId = activeDeviceId },
54+
Element{.metricId = PM_METRIC_GPU_MEM_SIZE, .deviceId = activeDeviceId }, // special case filling static
55+
Element{.metricId = PM_METRIC_GPU_MEM_USED, .deviceId = activeDeviceId },
56+
Element{.metricId = PM_METRIC_GPU_MEM_MAX_BANDWIDTH, .deviceId = activeDeviceId }, // special case filling static
57+
Element{.metricId = PM_METRIC_GPU_MEM_READ_BANDWIDTH, .deviceId = activeDeviceId },
58+
Element{.metricId = PM_METRIC_GPU_MEM_WRITE_BANDWIDTH, .deviceId = activeDeviceId },
59+
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 0 },
60+
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 1 },
61+
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 2 },
62+
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 3 },
63+
Element{.metricId = PM_METRIC_GPU_POWER_LIMITED, .deviceId = activeDeviceId },
64+
Element{.metricId = PM_METRIC_GPU_TEMPERATURE_LIMITED, .deviceId = activeDeviceId },
65+
Element{.metricId = PM_METRIC_GPU_CURRENT_LIMITED, .deviceId = activeDeviceId },
66+
Element{.metricId = PM_METRIC_GPU_VOLTAGE_LIMITED, .deviceId = activeDeviceId },
67+
Element{.metricId = PM_METRIC_GPU_UTILIZATION_LIMITED, .deviceId = activeDeviceId },
68+
Element{.metricId = PM_METRIC_GPU_MEM_POWER_LIMITED, .deviceId = activeDeviceId },
69+
Element{.metricId = PM_METRIC_GPU_MEM_TEMPERATURE_LIMITED, .deviceId = activeDeviceId },
70+
Element{.metricId = PM_METRIC_GPU_MEM_CURRENT_LIMITED, .deviceId = activeDeviceId },
71+
Element{.metricId = PM_METRIC_GPU_MEM_VOLTAGE_LIMITED, .deviceId = activeDeviceId },
72+
Element{.metricId = PM_METRIC_GPU_MEM_UTILIZATION_LIMITED, .deviceId = activeDeviceId },
73+
74+
Element{.metricId = PM_METRIC_CPU_UTILIZATION },
75+
Element{.metricId = PM_METRIC_CPU_POWER },
76+
Element{.metricId = PM_METRIC_CPU_TEMPERATURE },
77+
Element{.metricId = PM_METRIC_CPU_FREQUENCY },
78+
};
79+
80+
// we want the order in the output csv to match the order of the metric ids
81+
rn::sort(queryElements, {}, &Element::metricId);
82+
83+
return queryElements;
84+
}
85+
}

IntelPresentMon/Core/source/pmon/RawFrameDataWriter.cpp

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <PresentMonAPIWrapperCommon/EnumMap.h>
99
#include <format>
1010
#include <array>
11+
#include "RawFrameDataMetricList.h"
1112

1213
namespace p2c::pmon
1314
{
@@ -135,15 +136,7 @@ namespace p2c::pmon
135136
class QueryElementContainer_
136137
{
137138
public:
138-
// types
139-
struct ElementDefinition
140-
{
141-
PM_METRIC metricId;
142-
uint32_t deviceId;
143-
std::optional<uint32_t> index;
144-
};
145-
// functions
146-
QueryElementContainer_(std::span<const ElementDefinition> elements,
139+
QueryElementContainer_(std::span<const RawFrameQueryElementDefinition> elements,
147140
pmapi::Session& session, const pmapi::intro::Root& introRoot)
148141
{
149142
for (auto& el : elements) {
@@ -250,67 +243,7 @@ namespace p2c::pmon
250243
pStatsTracker{ frameStatsPath ? std::make_unique<StatisticsTracker>() : nullptr },
251244
file{ path }
252245
{
253-
using Element = QueryElementContainer_::ElementDefinition;
254-
255-
std::array queryElements{
256-
Element{.metricId = PM_METRIC_TIME, .deviceId = 0 },
257-
Element{.metricId = PM_METRIC_SWAP_CHAIN_ADDRESS, .deviceId = 0 },
258-
Element{.metricId = PM_METRIC_PRESENT_RUNTIME, .deviceId = 0 },
259-
Element{.metricId = PM_METRIC_SYNC_INTERVAL, .deviceId = 0 },
260-
Element{.metricId = PM_METRIC_PRESENT_FLAGS, .deviceId = 0 },
261-
Element{.metricId = PM_METRIC_ALLOWS_TEARING, .deviceId = 0 },
262-
Element{.metricId = PM_METRIC_PRESENT_MODE, .deviceId = 0 },
263-
Element{.metricId = PM_METRIC_CPU_FRAME_QPC, .deviceId = 0 },
264-
Element{.metricId = PM_METRIC_FRAME_TIME, .deviceId = 0 },
265-
Element{.metricId = PM_METRIC_CPU_BUSY, .deviceId = 0 },
266-
Element{.metricId = PM_METRIC_CPU_WAIT, .deviceId = 0 },
267-
Element{.metricId = PM_METRIC_GPU_LATENCY, .deviceId = 0 },
268-
Element{.metricId = PM_METRIC_GPU_TIME, .deviceId = 0 },
269-
Element{.metricId = PM_METRIC_GPU_BUSY, .deviceId = 0 },
270-
Element{.metricId = PM_METRIC_GPU_WAIT, .deviceId = 0 },
271-
Element{.metricId = PM_METRIC_DISPLAY_LATENCY, .deviceId = 0 },
272-
Element{.metricId = PM_METRIC_DISPLAYED_TIME, .deviceId = 0 },
273-
Element{.metricId = PM_METRIC_CLICK_TO_PHOTON_LATENCY, .deviceId = 0 },
274-
275-
Element{.metricId = PM_METRIC_GPU_POWER, .deviceId = activeDeviceId },
276-
Element{.metricId = PM_METRIC_GPU_VOLTAGE, .deviceId = activeDeviceId },
277-
Element{.metricId = PM_METRIC_GPU_FREQUENCY, .deviceId = activeDeviceId },
278-
Element{.metricId = PM_METRIC_GPU_TEMPERATURE, .deviceId = activeDeviceId },
279-
Element{.metricId = PM_METRIC_GPU_UTILIZATION, .deviceId = activeDeviceId },
280-
Element{.metricId = PM_METRIC_GPU_RENDER_COMPUTE_UTILIZATION, .deviceId = activeDeviceId },
281-
Element{.metricId = PM_METRIC_GPU_MEDIA_UTILIZATION, .deviceId = activeDeviceId },
282-
Element{.metricId = PM_METRIC_GPU_MEM_POWER, .deviceId = activeDeviceId },
283-
Element{.metricId = PM_METRIC_GPU_MEM_VOLTAGE, .deviceId = activeDeviceId },
284-
Element{.metricId = PM_METRIC_GPU_MEM_FREQUENCY, .deviceId = activeDeviceId },
285-
Element{.metricId = PM_METRIC_GPU_MEM_EFFECTIVE_FREQUENCY, .deviceId = activeDeviceId },
286-
Element{.metricId = PM_METRIC_GPU_MEM_TEMPERATURE, .deviceId = activeDeviceId },
287-
Element{.metricId = PM_METRIC_GPU_MEM_SIZE, .deviceId = activeDeviceId }, // special case filling static
288-
Element{.metricId = PM_METRIC_GPU_MEM_USED, .deviceId = activeDeviceId },
289-
Element{.metricId = PM_METRIC_GPU_MEM_MAX_BANDWIDTH, .deviceId = activeDeviceId }, // special case filling static
290-
Element{.metricId = PM_METRIC_GPU_MEM_READ_BANDWIDTH, .deviceId = activeDeviceId },
291-
Element{.metricId = PM_METRIC_GPU_MEM_WRITE_BANDWIDTH, .deviceId = activeDeviceId },
292-
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 0 },
293-
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 1 },
294-
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 2 },
295-
Element{.metricId = PM_METRIC_GPU_FAN_SPEED, .deviceId = activeDeviceId, .index = 3 },
296-
Element{.metricId = PM_METRIC_GPU_POWER_LIMITED, .deviceId = activeDeviceId },
297-
Element{.metricId = PM_METRIC_GPU_TEMPERATURE_LIMITED, .deviceId = activeDeviceId },
298-
Element{.metricId = PM_METRIC_GPU_CURRENT_LIMITED, .deviceId = activeDeviceId },
299-
Element{.metricId = PM_METRIC_GPU_VOLTAGE_LIMITED, .deviceId = activeDeviceId },
300-
Element{.metricId = PM_METRIC_GPU_UTILIZATION_LIMITED, .deviceId = activeDeviceId },
301-
Element{.metricId = PM_METRIC_GPU_MEM_POWER_LIMITED, .deviceId = activeDeviceId },
302-
Element{.metricId = PM_METRIC_GPU_MEM_TEMPERATURE_LIMITED, .deviceId = activeDeviceId },
303-
Element{.metricId = PM_METRIC_GPU_MEM_CURRENT_LIMITED, .deviceId = activeDeviceId },
304-
Element{.metricId = PM_METRIC_GPU_MEM_VOLTAGE_LIMITED, .deviceId = activeDeviceId },
305-
Element{.metricId = PM_METRIC_GPU_MEM_UTILIZATION_LIMITED, .deviceId = activeDeviceId },
306-
307-
Element{.metricId = PM_METRIC_CPU_UTILIZATION },
308-
Element{.metricId = PM_METRIC_CPU_POWER },
309-
Element{.metricId = PM_METRIC_CPU_TEMPERATURE },
310-
Element{.metricId = PM_METRIC_CPU_FREQUENCY },
311-
};
312-
// we want the order in the output csv to match the order of the metric ids
313-
rn::sort(queryElements, {}, &Element::metricId);
246+
auto queryElements = GetRawFrameDataMetricList(activeDeviceId);
314247
pQueryElementContainer = std::make_unique<QueryElementContainer_>(queryElements, session, introRoot);
315248
blobs = pQueryElementContainer->MakeBlobs(numberOfBlobs);
316249

IntelPresentMon/Interprocess/source/metadata/EnumMetric.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// enum annotation (enum_name_fragment, key_name_fragment, name, short_name, description)
55
#define ENUM_KEY_LIST_METRIC(X_) \
6-
X_(METRIC, APPLICATION, "Application", "", "Name of the executable of the process being targetted") \
6+
X_(METRIC, APPLICATION, "Application", "", "Name of the executable of the process being targeted") \
77
X_(METRIC, SWAP_CHAIN_ADDRESS, "Swap Chain Address", "", "Address of the swap chain used to present, useful as a unique identifier") \
88
\
99
X_(METRIC, GPU_VENDOR, "GPU Vendor", "", "Vendor name of the GPU") \
@@ -41,7 +41,7 @@
4141
\
4242
X_(METRIC, GPU_SUSTAINED_POWER_LIMIT, "GPU Sustained Power Limit", "", "Sustained power limit of the GPU") \
4343
X_(METRIC, GPU_POWER, "GPU Power", "", "Power consumed by the graphics adapter") \
44-
X_(METRIC, GPU_VOLTAGE, "GPU Voltage", "", "Voltage consumet by the graphics adapter") \
44+
X_(METRIC, GPU_VOLTAGE, "GPU Voltage", "", "Voltage consumed by the graphics adapter") \
4545
X_(METRIC, GPU_FREQUENCY, "GPU Frequency", "", "Clock speed of the GPU cores") \
4646
X_(METRIC, GPU_TEMPERATURE, "GPU Temperature", "", "Temperature of the GPU") \
4747
X_(METRIC, GPU_FAN_SPEED, "GPU Fan Speed", "", "Rate at which a GPU cooler fan is rotating") \
@@ -56,7 +56,7 @@
5656
X_(METRIC, GPU_UTILIZATION_LIMITED, "GPU Utilization Limited", "", "GPU frequency is being limited due to low GPU utilization") \
5757
\
5858
X_(METRIC, GPU_MEM_POWER, "GPU Memory Power", "", "Power consumed by the GPU memory") \
59-
X_(METRIC, GPU_MEM_VOLTAGE, "GPU Memory Voltage", "", "Voltage consumet by the GPU memory") \
59+
X_(METRIC, GPU_MEM_VOLTAGE, "GPU Memory Voltage", "", "Voltage consumed by the GPU memory") \
6060
X_(METRIC, GPU_MEM_FREQUENCY, "GPU Memory Frequency", "", "Clock speed of the GPU memory") \
6161
X_(METRIC, GPU_MEM_EFFECTIVE_FREQUENCY, "GPU Memory Effective Frequency", "", "Effective data transfer rate GPU memory can sustain") \
6262
X_(METRIC, GPU_MEM_TEMPERATURE, "GPU Memory Temperature", "", "Temperature of the GPU memory") \

IntelPresentMon/SampleClient/CliOptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace clio
1212
Flag dynamicQuerySample{ this, "--dynamic-query-sample", "Example of how to use a dynamic query to poll metric data" };
1313
Flag frameQuerySample{ this, "--frame-query-sample", "Example of how to use a frame query to consume raw frame data" };
1414
Flag checkMetricSample{ this, "--check-metric-sample", "Example of how to check metric availability for a single metric" };
15+
Flag metricListSample{ this, "--metric-list-sample", "List of all metrics in markdown format" };
1516
Flag wrapperStaticQuerySample{ this, "--wrapper-static-query-sample", "Example of using the wrapper to poll static metric data" };
1617
Flag genCsv{ this, "--gen-csv", "Example of creating a csv file from consumed raw frame data" };
1718
Flag addGPUMetric{ this, "--add-gpu-metric", "Example of how to search for an available GPU metric and add it to a dynamic query" };
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#pragma once
2+
#include <fstream>
3+
#include <format>
4+
#include <ranges>
5+
#include "../PresentMonAPI2/PresentMonAPI.h"
6+
#include "../Core/source/pmon/RawFrameDataMetricList.h"
7+
8+
int MetricListSample(pmapi::Session& session)
9+
{
10+
namespace rn = std::ranges;
11+
namespace vi = rn::views;
12+
13+
std::ofstream out{ "metrics.md" };
14+
15+
// header
16+
out << "| Metric | CSV Column | Description | Compatible Query Types |\n"
17+
<< "| - | - | - |:-:|\n";
18+
19+
// get list of metrics used in CSV (as vector of query element definitions)
20+
const auto csvElements = p2c::pmon::GetRawFrameDataMetricList(0);
21+
22+
// Loop through ALL PresentMon metrics
23+
for (auto metric : session.GetIntrospectionRoot()->GetMetrics()) {
24+
// get CSV column name if this metric is used in CSV capture file
25+
std::string csvColumnName;
26+
if (rn::contains(csvElements, metric.GetId(), &p2c::pmon::RawFrameQueryElementDefinition::metricId)) {
27+
csvColumnName = metric.Introspect().GetName()
28+
| vi::filter([](char c) { return c != ' '; })
29+
| rn::to<std::basic_string>();
30+
}
31+
// name and description
32+
out << std::format("|{}|{}|{}|",
33+
metric.Introspect().GetName(),
34+
csvColumnName,
35+
metric.Introspect().GetDescription()
36+
);
37+
// query compatibility codes
38+
switch (metric.GetType()) {
39+
case PM_METRIC_TYPE_DYNAMIC: out << "D|\n"; break;
40+
case PM_METRIC_TYPE_DYNAMIC_FRAME: out << "DF|\n"; break;
41+
case PM_METRIC_TYPE_FRAME_EVENT: out << "F|\n"; break;
42+
case PM_METRIC_TYPE_STATIC: out << "DS|\n"; break;
43+
default: out << "|\n";
44+
}
45+
}
46+
47+
// footer
48+
out << "*Query Type Codes: **D** = Dynamic Query, **F** = Frame Event Query, **S** = Static Query\n";
49+
50+
return 0;
51+
}

IntelPresentMon/SampleClient/SampleClient.args.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"FileVersion": 2,
33
"Id": "79fe382a-c29c-4c32-a028-b8d1abdf51b0",
44
"Items": [
5+
{
6+
"Id": "bd38c9b9-08d6-4f8a-af30-2ca066c65af5",
7+
"Command": "--metric-list-sample"
8+
},
59
{
610
"Id": "55055cc7-7bbb-4db3-8f8f-27f1b5994bd2",
711
"Command": "--wrapper-static-query-sample"

0 commit comments

Comments
 (0)