2.10.15: PERF report 2 min after the world loaded, then every 5 min, and a final one when quitting; reset per scene

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 21:57:10 +02:00
co-authored by Claude Opus 5.5
parent 47c172859c
commit 06d3834576
4 changed files with 21 additions and 5 deletions
+1
View File
@@ -272,6 +272,7 @@ namespace MSCO
void OnApplicationQuit() void OnApplicationQuit()
{ {
try { PerfStats.FinalReport(); } catch { }
// Wer beendet das Spiel? (Diagnose) // Wer beendet das Spiel? (Diagnose)
Bootstrap.Log("Game is quitting (scene " + Application.loadedLevelName + "): " + System.Environment.StackTrace); Bootstrap.Log("Game is quitting (scene " + Application.loadedLevelName + "): " + System.Environment.StackTrace);
} }
+5
View File
@@ -1,5 +1,10 @@
# Changelog # Changelog
## 2.10.15
- Leistungsbericht: der erste kommt 2 Minuten nach dem Laden der Welt (das Laden zählt nicht mehr mit), danach alle
5 Minuten, und beim Beenden des Spiels einer für die letzten Minuten
## 2.10.14 ## 2.10.14
- **Hinweis bei Debug-Startoptionen:** Stehen in den Steam-Startoptionen von My Summer Car noch - **Hinweis bei Debug-Startoptionen:** Stehen in den Steam-Startoptionen von My Summer Car noch
+1 -1
View File
@@ -11,7 +11,7 @@ namespace MSCO
/// Version der Mod. Kleine Updates: nur die dritte Stelle erhöhen (2.9.1, 2.9.2 ...) - sie bleiben mit /// Version der Mod. Kleine Updates: nur die dritte Stelle erhöhen (2.9.1, 2.9.2 ...) - sie bleiben mit
/// Servern und Mitspielern derselben ersten zwei Stellen kompatibel. /// Servern und Mitspielern derselben ersten zwei Stellen kompatibel.
/// </summary> /// </summary>
public const string ModVersion = "2.10.14"; public const string ModVersion = "2.10.15";
/// <summary> /// <summary>
/// Netzwerk-Version (die ersten beiden Stellen). Nur erhöhen, wenn sich das Protokoll inkompatibel ändert - dann /// Netzwerk-Version (die ersten beiden Stellen). Nur erhöhen, wenn sich das Protokoll inkompatibel ändert - dann
/// auch GameServer.ModVersion im Server. /// auch GameServer.ModVersion im Server.
+14 -4
View File
@@ -18,6 +18,8 @@ namespace MSCO
static int frames, gcStart = -1; static int frames, gcStart = -1;
static double frameSeconds, worstFrame; static double frameSeconds, worstFrame;
static float started = -1f; static float started = -1f;
static int level = -1;
static int reports;
static readonly bool autoLog = Array.IndexOf(Environment.GetCommandLineArgs(), "-msco-perf") >= 0; static readonly bool autoLog = Array.IndexOf(Environment.GetCommandLineArgs(), "-msco-perf") >= 0;
public static void Add(string part, double ms) public static void Add(string part, double ms)
@@ -30,20 +32,28 @@ namespace MSCO
/// <summary>Einmal pro Bild (Update).</summary> /// <summary>Einmal pro Bild (Update).</summary>
public static void Frame(float dt) public static void Frame(float dt)
{ {
if (started < 0f) Reset(); // Neue Szene (Menü -> Spiel): neu anfangen, sonst zählt das Laden mit
if (started < 0f || Application.loadedLevel != level) { level = Application.loadedLevel; reports = 0; Reset(); }
frames++; frames++;
frameSeconds += dt; frameSeconds += dt;
if (dt > worstFrame) worstFrame = dt; if (dt > worstFrame) worstFrame = dt;
// Mit -msco-perf alle 30 s, sonst im Spiel alle 5 Minuten ein Bericht in MSCO_Loader.txt - so lässt sich bei // Mit -msco-perf alle 30 s, sonst im Spiel nach 2 Minuten und dann alle 5 Minuten ein Bericht in MSCO_Loader.txt -
// "wenig FPS" nachsehen, ob MSCO, eine Mod oder das Spiel selbst die Zeit braucht // so lässt sich bei "wenig FPS" nachsehen, ob MSCO, eine Mod oder das Spiel selbst die Zeit braucht
float every = autoLog ? 30f : 300f; float every = autoLog ? 30f : reports == 0 ? 120f : 300f;
if ((autoLog || MenuHelper.InGame) && Time.realtimeSinceStartup - started >= every) if ((autoLog || MenuHelper.InGame) && Time.realtimeSinceStartup - started >= every)
{ {
Bootstrap.Log(Report()); Bootstrap.Log(Report());
reports++;
Reset(); Reset();
} }
} }
/// <summary>Beim Beenden: was seit dem letzten Bericht gemessen wurde (mindestens 20 s im Spiel).</summary>
public static void FinalReport()
{
if (frames > 0 && MenuHelper.InGame && Time.realtimeSinceStartup - started >= 20f) Bootstrap.Log(Report());
}
public static void Reset() public static void Reset()
{ {
totals.Clear(); totals.Clear();