diff --git a/src/ECS/Systems/BaseSystem.cs b/src/ECS/Systems/BaseSystem.cs index 46c6cbd3..52af80f8 100644 --- a/src/ECS/Systems/BaseSystem.cs +++ b/src/ECS/Systems/BaseSystem.cs @@ -267,8 +267,8 @@ public string GetPerfLog() /// public void AppendPerfLog(StringBuilder stringBuilder) { var stores = SystemRoot?.stores.count ?? 0; - stringBuilder.Append($"stores: {stores,-3} on last ms sum ms updates last mem sum mem entities\n"); - stringBuilder.Append("--------------------- -- -------- -------- -------- -------- -------- --------\n"); + stringBuilder.Append($"stores: {stores,-3} E M last ms sum ms updates last mem sum mem entities\n"); + stringBuilder.Append("--------------------- --- -------- -------- -------- -------- -------- --------\n"); AppendPerfStats(stringBuilder, 0); stringBuilder.Replace(',', '.'); // no more patience with NumberFormatInfo } @@ -288,9 +288,16 @@ internal virtual void AppendPerfStats(StringBuilder sb, int depth) sb.Append(group.childSystems.Count); sb.Append(']'); } + bool monitored; + if (this is SystemGroup) { + monitored = ((SystemGroup)this).MonitorPerf; + } else { + monitored = parentGroup?.MonitorPerf ?? false; + } var len = 30 - (sb.Length - start); sb.Append(' ', len); - sb.Append(enabled ? " +" : " -"); + sb.Append(enabled ? "+ " : "- "); + sb.Append(monitored ? "m" : " "); sb.Append($" {(double)Perf.LastMs,12:0.000}"); // (double) prevents allocation sb.Append($" {(double)Perf.SumMs,12:0.000}"); sb.Append($" {Perf.UpdateCount,12}"); diff --git a/src/Tests-internal/ECS/Test_Systems.cs b/src/Tests-internal/ECS/Test_Systems.cs index f297e6c0..79e3a2dd 100644 --- a/src/Tests-internal/ECS/Test_Systems.cs +++ b/src/Tests-internal/ECS/Test_Systems.cs @@ -136,12 +136,12 @@ public static void Test_Systems_AllSystems() root.AppendPerfLog(sb); var log = sb.ToString(); AreEqual( -@"stores: 0 on last ms sum ms updates last mem sum mem entities ---------------------- -- -------- -------- -------- -------- -------- -------- -Systems [1] + -1.000 0.000 0 0 0 -| Update [2] + -1.000 0.000 0 0 0 -| TestSystem1 + -1.000 0.000 0 0 0 0 -| MySystem1 - -1.000 0.000 0 0 0 +@"stores: 0 E M last ms sum ms updates last mem sum mem entities +--------------------- --- -------- -------- -------- -------- -------- -------- +Systems [1] + m -1.000 0.000 0 0 0 +| Update [2] + m -1.000 0.000 0 0 0 +| TestSystem1 + m -1.000 0.000 0 0 0 0 +| MySystem1 - m -1.000 0.000 0 0 0 ", log); sb.Clear(); diff --git a/src/Tests/ECS/Systems/Test_SystemGroup.cs b/src/Tests/ECS/Systems/Test_SystemGroup.cs index 779b512c..64aad2fa 100644 --- a/src/Tests/ECS/Systems/Test_SystemGroup.cs +++ b/src/Tests/ECS/Systems/Test_SystemGroup.cs @@ -392,9 +392,9 @@ public static void Test_SystemGroup_Perf() var emptyLog = perfSystem1.GetPerfLog(); AreEqual( -@"stores: 0 on last ms sum ms updates last mem sum mem entities ---------------------- -- -------- -------- -------- -------- -------- -------- -PerfSystem + -1.000 0.000 0 0 0 +@"stores: 0 E M last ms sum ms updates last mem sum mem entities +--------------------- --- -------- -------- -------- -------- -------- -------- +PerfSystem + -1.000 0.000 0 0 0 ", emptyLog); root.Add(child1); diff --git a/src/Tests/ECS/Systems/Test_SystemRoot.cs b/src/Tests/ECS/Systems/Test_SystemRoot.cs index 1e52d696..64770364 100644 --- a/src/Tests/ECS/Systems/Test_SystemRoot.cs +++ b/src/Tests/ECS/Systems/Test_SystemRoot.cs @@ -110,20 +110,30 @@ public static void Test_SystemRoot_Add_System() AreEqual(1, testSystem1.EntityCount); AreSame(root, testSystem1.SystemRoot); + // MonitorPerf is disabled by default. So the 'M' column is empty + Console.WriteLine(root.GetPerfLog()); +AreEqual( + @"stores: 1 E M last ms sum ms updates last mem sum mem entities +--------------------- --- -------- -------- -------- -------- -------- -------- +Systems [1] + -1.000 0.000 0 0 0 +| Update [1] + -1.000 0.000 0 0 0 +| TestSystem1 + -1.000 0.000 0 0 0 1 +", root.GetPerfLog()); + root.SetMonitorPerf(true); Console.WriteLine(root.GetPerfLog()); AreEqual( -@"stores: 1 on last ms sum ms updates last mem sum mem entities ---------------------- -- -------- -------- -------- -------- -------- -------- -Systems [1] + -1.000 0.000 0 0 0 -| Update [1] + -1.000 0.000 0 0 0 -| TestSystem1 + -1.000 0.000 0 0 0 1 +@"stores: 1 E M last ms sum ms updates last mem sum mem entities +--------------------- --- -------- -------- -------- -------- -------- -------- +Systems [1] + m -1.000 0.000 0 0 0 +| Update [1] + m -1.000 0.000 0 0 0 +| TestSystem1 + m -1.000 0.000 0 0 0 1 ", root.GetPerfLog()); AreEqual( -@"stores: 1 on last ms sum ms updates last mem sum mem entities ---------------------- -- -------- -------- -------- -------- -------- -------- -TestSystem1 + -1.000 0.000 0 0 0 1 +@"stores: 1 E M last ms sum ms updates last mem sum mem entities +--------------------- --- -------- -------- -------- -------- -------- -------- +TestSystem1 + m -1.000 0.000 0 0 0 1 ", testSystem1.GetPerfLog()); var tick = new UpdateTick(42, 0);