The PresentMon .NET Wrapper for calculating FPS.
Nuget:https://www.nuget.org/packages/PresentMonFps
// Check Available.
if (!FpsInspector.IsAvailable)
{
Console.WriteLine("This library is only available on Windows.");
return;
}
// Simple method to get PID.
// Fullname is unnecessary.
uint pid = await FpsInspector.GetProcessIdByNameAsync("YourApp.exe");
// Calculate FPS Once.
FpsResult result = await FpsInspector.StartOnceAsync(new FpsRequest(pid));
Console.WriteLine(result);
// Calculate FPS Forever.
await FpsInspector.StartForeverAsync(new FpsRequest(pid), Console.WriteLine, null!);
See more from PresentMon.SampleWPF and PresentMon.SampleConsole.