Skip to content

Commit 51518c7

Browse files
committed
ExtendedTools: Add present runtime to frames tab
1 parent 2779bc8 commit 51518c7

File tree

5 files changed

+100
-5
lines changed

5 files changed

+100
-5
lines changed

plugins/ExtendedTools/PresentMon/PresentMon.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ VOID PresentMonUpdateProcessStats(
261261
auto const& present0 = *chain.mPresentHistory[(chain.mNextPresentIndex - chain.mPresentHistoryCount) % SwapChainData::PRESENT_HISTORY_MAX_COUNT];
262262
auto const& presentN = *chain.mPresentHistory[(chain.mNextPresentIndex - 1) % SwapChainData::PRESENT_HISTORY_MAX_COUNT];
263263
auto const& lastPresented = *chain.mPresentHistory[(chain.mNextPresentIndex - 2) % SwapChainData::PRESENT_HISTORY_MAX_COUNT];
264+
USHORT runtime = static_cast<USHORT>(presentN.Runtime);
265+
USHORT presentMode = static_cast<USHORT>(presentN.PresentMode);
264266
DOUBLE cpuAvg;
265267
DOUBLE dspAvg = 0.0;
266268
DOUBLE latAvg = 0.0;
@@ -352,7 +354,9 @@ VOID PresentMonUpdateProcessStats(
352354
msBetweenPresents,
353355
msInPresentApi,
354356
msUntilRenderComplete,
355-
msUntilDisplayed
357+
msUntilDisplayed,
358+
runtime,
359+
presentMode
356360
);
357361
}
358362
}

plugins/ExtendedTools/exttools.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ typedef struct _ET_PROCESS_BLOCK
362362
FLOAT FramesMsUntilRenderComplete;
363363
FLOAT FramesMsUntilDisplayed;
364364
FLOAT FramesDisplayLatency;
365+
USHORT FramesRuntime;
366+
USHORT FramesPresentMode;
365367
PH_CIRCULAR_BUFFER_FLOAT FramesPerSecondHistory;
366368
PH_CIRCULAR_BUFFER_FLOAT FramesLatencyHistory;
367369
PH_CIRCULAR_BUFFER_FLOAT FramesMsBetweenPresentsHistory;

plugins/ExtendedTools/framemon.cpp

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ VOID EtAddGpuFrameToHashTable(
139139
_In_ DOUBLE MsBetweenPresents,
140140
_In_ DOUBLE MsInPresentApi,
141141
_In_ DOUBLE MsUntilRenderComplete,
142-
_In_ DOUBLE MsUntilDisplayed
142+
_In_ DOUBLE MsUntilDisplayed,
143+
_In_ USHORT Runtime,
144+
_In_ USHORT PresentMode
143145
)
144146
{
145147
ET_FPS_COUNTER lookupEntry;
@@ -166,6 +168,10 @@ VOID EtAddGpuFrameToHashTable(
166168
entry->DisplayLatency = DisplayLatency;
167169
//if (entry->DisplayFramesPerSecond < DisplayFramesPerSecond)
168170
// entry->DisplayFramesPerSecond = DisplayFramesPerSecond;
171+
if (entry->Runtime != Runtime)
172+
entry->Runtime = Runtime;
173+
if (entry->PresentMode != PresentMode)
174+
entry->PresentMode = PresentMode;
169175
}
170176
else
171177
{
@@ -178,6 +184,8 @@ VOID EtAddGpuFrameToHashTable(
178184
lookupEntry.MsUntilDisplayed = MsUntilDisplayed;
179185
lookupEntry.DisplayLatency = DisplayLatency;
180186
//lookupEntry.DisplayFramesPerSecond = DisplayFramesPerSecond;
187+
lookupEntry.Runtime = Runtime;
188+
lookupEntry.PresentMode = PresentMode;
181189

182190
PhAddEntryHashtable(EtFramesHashTable, &lookupEntry);
183191
}
@@ -229,6 +237,8 @@ VOID EtProcessFramesUpdateProcessBlock(
229237
ProcessBlock->FramesMsUntilDisplayed = (FLOAT)entry->MsUntilDisplayed;
230238
ProcessBlock->FramesDisplayLatency = (FLOAT)entry->DisplayLatency;
231239
//ProcessBlock->FramesDisplayFramesPerSecond = (FLOAT)entry->DisplayFramesPerSecond;
240+
ProcessBlock->FramesRuntime = entry->Runtime;
241+
ProcessBlock->FramesPresentMode = entry->PresentMode;
232242

233243
PhAddItemCircularBuffer_FLOAT(&ProcessBlock->FramesPerSecondHistory, ProcessBlock->FramesPerSecond);
234244
PhAddItemCircularBuffer_FLOAT(&ProcessBlock->FramesLatencyHistory, ProcessBlock->FramesLatency);
@@ -249,6 +259,8 @@ VOID EtProcessFramesUpdateProcessBlock(
249259
ProcessBlock->FramesMsUntilDisplayed = 0;
250260
ProcessBlock->FramesDisplayLatency = 0;
251261
//ProcessBlock->FramesDisplayFramesPerSecond = 0;
262+
ProcessBlock->FramesRuntime = 0;
263+
ProcessBlock->FramesPresentMode = 0;
252264

253265
PhAddItemCircularBuffer_FLOAT(&ProcessBlock->FramesPerSecondHistory, 0);
254266
PhAddItemCircularBuffer_FLOAT(&ProcessBlock->FramesLatencyHistory, 0);
@@ -260,3 +272,45 @@ VOID EtProcessFramesUpdateProcessBlock(
260272
//PhAddItemCircularBuffer_FLOAT(&ProcessBlock->FramesDisplayFramesPerSecondHistory, 0);
261273
}
262274
}
275+
276+
PCWSTR EtPresentModeToString(
277+
_In_ USHORT PresentMode
278+
)
279+
{
280+
switch (PresentMode)
281+
{
282+
case 1:
283+
return L"Hardware: Legacy Flip";
284+
case 2:
285+
return L"Hardware: Legacy Copy to front buffer";
286+
case 3:
287+
return L"Hardware: Independent Flip";
288+
case 4:
289+
return L"Composed: Flip";
290+
case 5:
291+
return L"Composed: Copy with GPU GDI";
292+
case 6:
293+
return L"Composed: Copy with CPU GDI";
294+
case 7:
295+
return L"Composed: Composition Atlas";
296+
case 8:
297+
return L"Hardware Composed: Independent Flip";
298+
}
299+
300+
return L"Other";
301+
}
302+
303+
PCWSTR EtRuntimeToString(
304+
_In_ USHORT Runtime
305+
)
306+
{
307+
switch (Runtime)
308+
{
309+
case 0:
310+
return L"DXGI";
311+
case 1:
312+
return L"D3D9";
313+
}
314+
315+
return L"Other";
316+
}

plugins/ExtendedTools/framemon.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ typedef struct _ET_FPS_COUNTER
3737
DOUBLE MsUntilRenderComplete;
3838
DOUBLE MsUntilDisplayed;
3939
DOUBLE DisplayLatency;
40-
//DOUBLE DisplayFramesPerSecond;
40+
//DOUBLE DisplayFramesPerSecond;
41+
USHORT Runtime;
42+
USHORT PresentMode;
4143
} ET_FPS_COUNTER, *PET_FPS_COUNTER;
4244

4345
VOID EtFramesMonitorInitialization(
@@ -65,7 +67,9 @@ VOID EtAddGpuFrameToHashTable(
6567
_In_ DOUBLE MsBetweenPresents,
6668
_In_ DOUBLE MsInPresentApi,
6769
_In_ DOUBLE MsUntilRenderComplete,
68-
_In_ DOUBLE MsUntilDisplayed
70+
_In_ DOUBLE MsUntilDisplayed,
71+
_In_ USHORT Runtime,
72+
_In_ USHORT PresentMode
6973
);
7074

7175
VOID EtLockGpuFrameHashTable(
@@ -84,6 +88,14 @@ VOID EtProcessFramesUpdateProcessBlock(
8488
_In_ struct _ET_PROCESS_BLOCK* ProcessBlock
8589
);
8690

91+
PCWSTR EtPresentModeToString(
92+
_In_ USHORT PresentMode
93+
);
94+
95+
PCWSTR EtRuntimeToString(
96+
_In_ USHORT Runtime
97+
);
98+
8799
// PresentMon.hpp
88100

89101
BOOLEAN StartFpsTraceSession(

plugins/ExtendedTools/frameprp.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,29 @@ VOID FramesPropUpdateGraphs(
383383
InvalidateRect(Context->FramesDisplayLatencyGraphHandle, NULL, FALSE);
384384
}
385385

386+
VOID FramesPropUpdatePanel(
387+
_In_ PET_FRAMES_CONTEXT Context
388+
)
389+
{
390+
PCWSTR runtime;
391+
PCWSTR presentMode;
392+
PPH_STRING string;
393+
PH_FORMAT format[5];
394+
395+
runtime = EtRuntimeToString(Context->Block->FramesRuntime);
396+
presentMode = EtPresentModeToString(Context->Block->FramesPresentMode);
397+
398+
PhInitFormatS(&format[0], L"FPS: ");
399+
PhInitFormatS(&format[1], (PWSTR)presentMode);
400+
PhInitFormatS(&format[2], L" (");
401+
PhInitFormatS(&format[3], (PWSTR)runtime);
402+
PhInitFormatC(&format[4], L')');
403+
404+
string = PhFormat(format, RTL_NUMBER_OF(format), 0);
405+
PhSetWindowText(Context->FramesPerSecondGroupBox, PhGetString(string));
406+
PhDereferenceObject(string);
407+
}
408+
386409
VOID NTAPI FramesProcessesUpdatedHandler(
387410
_In_opt_ PVOID Parameter,
388411
_In_opt_ PVOID Context
@@ -1091,7 +1114,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
10911114
if (!(processItem->State & PH_PROCESS_ITEM_REMOVED) && context->Enabled)
10921115
{
10931116
FramesPropUpdateGraphs(context);
1094-
//FramesPropUpdatePanel(context);
1117+
FramesPropUpdatePanel(context);
10951118
}
10961119
}
10971120
break;

0 commit comments

Comments
 (0)