aiRobots.SimpleFPS
1.2.1
dotnet add package aiRobots.SimpleFPS --version 1.2.1
NuGet\Install-Package aiRobots.SimpleFPS -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="aiRobots.SimpleFPS" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="aiRobots.SimpleFPS" Version="1.2.1" />
<PackageReference Include="aiRobots.SimpleFPS" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add aiRobots.SimpleFPS --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: aiRobots.SimpleFPS, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package aiRobots.SimpleFPS@1.2.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=aiRobots.SimpleFPS&version=1.2.1
#tool nuget:?package=aiRobots.SimpleFPS&version=1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SimpleFPS
This is a simple FPS calculation tool.

Getting Started
Import the following namespace.
using aiRobots;
Initialize SimpleFPS using the following methods.
SimpleFPS fps_tool_m1;
SimpleFPS fps_tool_m3;
AverageFPS fps_tool_m2;
// method 1
fps_tool_m1 = new SimpleFPS();
// method 2
fps_tool_m2 = new AverageFPS();
// method 3
fps_tool_m3 = new SimpleFPS();
fps_tool_m3.FPSUpdated += (object sender, SimpleFPS_Args e) =>
{
msg_out($"method3 fps = {e.FPS}", fore: ConsoleColor.Yellow);
};
Place FPSUpdate where you want to measure FPS
// FPS method1: basic fixed time frame number method
fps_tool_m1.FPSUpdate();
msg_out($"method1 fps = {fps_tool_m1.FPS}", fore: ConsoleColor.Blue);
// FPS method2 by average sampling time method
fps_tool_m2.FPSUpdate();
msg_out($"method2 fps = {fps_tool_m2.FPS}", fore: ConsoleColor.Cyan);
// FPS method3: update by event
fps_tool_m3.FPSUpdate();
Example
Console mode
Program.cs
using aiRobots;
System.Timers.Timer interval_timer;
SimpleFPS fps_tool_m1;
SimpleFPS fps_tool_m3;
AverageFPS fps_tool_m2;
void initial()
{
// method 1
fps_tool_m1 = new SimpleFPS();
// method 2
fps_tool_m2 = new AverageFPS();
// method 3
fps_tool_m3 = new SimpleFPS();
fps_tool_m3.FPSUpdated += (object sender, SimpleFPS_Args e) =>
{
msg_out($"method3 fps = {e.FPS}", fore: ConsoleColor.Yellow);
};
// init interval timer
Console.WriteLine("initial timer with tick...");
interval_timer = new System.Timers.Timer(200); // interval 200 msec => fps 5
interval_timer.Elapsed += timer_tick;
interval_timer.AutoReset = true;
interval_timer.Enabled = true;
}
void deinitial()
{
interval_timer.Enabled = false;
}
void press_enter()
{
System.Console.WriteLine("press enter to close...");
System.Console.ReadLine(); //block
}
string now()
{
return System.DateTime.Now.ToString("HH:mm:ss.fff");
}
void msg_out(string msg, ConsoleColor back = ConsoleColor.Black, ConsoleColor fore = ConsoleColor.White)
{
Console.BackgroundColor = back;
Console.ForegroundColor = fore;
Console.WriteLine($"[{now()}] {msg}");
Console.ResetColor();
}
void timer_tick(Object source, System.Timers.ElapsedEventArgs e)
{
// FPS method1: basic fixed time frame number method
fps_tool_m1.FPSUpdate();
msg_out($"method1 fps = {fps_tool_m1.FPS}", fore: ConsoleColor.Blue);
// FPS method2 by average sampling time method
fps_tool_m2.FPSUpdate();
msg_out($"method2 fps = {fps_tool_m2.FPS}", fore: ConsoleColor.Cyan);
// FPS method3: update by event
fps_tool_m3.FPSUpdate();
}
initial();
press_enter();
deinitial();
Windows Form

private AverageFPS fps_tool = new AverageFPS();
private void Form1_Load(object sender, EventArgs e)
{
this.timer1.Interval = 15;
this.timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Text = $"Interval = {this.timer1.Interval}ms, FPS = {fps_tool.FPSUpdate():0.00}";
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.