File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ public bool IsCorePlugin
140140 /// </summary>
141141 /// <value>The total hook time.</value>
142142 public double TotalHookTime { get ; internal set ; }
143+ public long TotalHookMemory { get ; internal set ; }
144+ private long _currentMemoryUsed { get ; set ; }
143145
144146 // Used to measure time spent in this plugin
145147 private Stopwatch trackStopwatch = new Stopwatch ( ) ;
@@ -346,6 +348,7 @@ public void TrackStart()
346348 return ;
347349 }
348350
351+ _currentMemoryUsed = GetMemory ( ) ;
349352 stopwatch . Start ( ) ;
350353 }
351354
@@ -364,9 +367,13 @@ public void TrackEnd()
364367
365368 stopwatch . Stop ( ) ;
366369 TotalHookTime += stopwatch . Elapsed . TotalSeconds ;
370+ TotalHookMemory += Math . Max ( 0 , GetMemory ( ) - _currentMemoryUsed ) ;
367371 stopwatch . Reset ( ) ;
368372 }
369373
374+ private static long GetMemory ( )
375+ => GC . GetTotalMemory ( false ) ;
376+
370377 #region Config
371378
372379 /// <summary>
You can’t perform that action at this time.
0 commit comments