add instance metrics to server

This commit is contained in:
ppc
2024-09-04 10:17:14 +01:00
parent 20577f76f0
commit cff5989a8d
4 changed files with 31 additions and 4 deletions
+8
View File
@@ -1,3 +1,4 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
@@ -13,6 +14,10 @@ public static class DllMain
{
private const string WebAddress = "http://card.ppc.moe";
// instance metrics
internal static long LastPollTime = -1;
internal static long ServerStartedAt;
static DllMain()
{
PInvoke.AllocConsole();
@@ -38,6 +43,7 @@ public static class DllMain
cancellationRegistration?.Dispose();
});
Volatile.Write(ref ServerStartedAt, Environment.TickCount64);
App.RunAsync();
return 0;
}
@@ -45,6 +51,8 @@ public static class DllMain
[UnmanagedCallersOnly(EntryPoint = "aime_io_nfc_poll")]
public static int NfcPoll(byte unitNo)
{
Volatile.Write(ref LastPollTime, Environment.TickCount64);
if (!Config.EnableAimeTxt)
{
return 1;