static public void ResetAll() { ArrayList newSections = new ArrayList(); foreach (WeakReference wr in s_sections) { if (wr.IsAlive) { ProfilingSection ps = (ProfilingSection)wr.Target; ps.Reset(); newSections.Add(wr); } } s_sections = newSections; }
static public string GetStatsString() { System.GC.Collect(); StringWriter sw = new StringWriter(); sw.WriteLine("ProfilingSection Statistics"); string prefix = "\t"; ArrayList newSections = new ArrayList(); foreach (WeakReference wr in s_sections) { if (wr.IsAlive) { ProfilingSection ps = (ProfilingSection)wr.Target; sw.WriteLine(prefix + ps.ToString()); newSections.Add(wr); } } s_sections = newSections; return(sw.ToString()); }