Пример #1
0
 public GCStatsSnapshot GetSnapshot(bool reset = false)
 {
     lock (myLock)
     {
         var newSnapshot = new GCStatsSnapshot(GC.CollectionCount(0) - lastSnapshot.Gen0,
                                               GC.CollectionCount(1) - lastSnapshot.Gen1,
                                               GC.CollectionCount(2) - lastSnapshot.Gen2);
         if (reset)
         {
             lastSnapshot = newSnapshot;
         }
         return(newSnapshot);
     }
 }
Пример #2
0
 public GCStats()
 {
     lastSnapshot = new GCStatsSnapshot(GC.CollectionCount(0), GC.CollectionCount(1), GC.CollectionCount(2));
 }