All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Common.Stats.GCStats Maven / Gradle / Ivy

package Alachisoft.NCache.Common.Stats;

public class GCStats {
//	//GC counters
//	private PerformanceCounter _gcGen0;
//	private PerformanceCounter _gcGen1;
//	private PerformanceCounter _gcGen2;
//	private PerformanceCounter _gcTime;
//	private String _instance;
//	private boolean _initialized;
//	public GCStats(String instance) {
//		_instance = instance;
//	}
//
//	public final void Initialize() {
//		try {
//			_gcGen0 = new PerformanceCounter(".NET CLR Memory", "# Gen 0 Collections", _instance, true);
//			_gcGen1 = new PerformanceCounter(".NET CLR Memory", "# Gen 1 Collections", _instance, true);
//			_gcGen2 = new PerformanceCounter(".NET CLR Memory", "# Gen 2 Collections", _instance, true);
//			_gcTime = new PerformanceCounter(".NET CLR Memory", "% Time in GC", _instance, true);
//			_initialized = true;
//		} catch (RuntimeException e) {
//			//Trace.error("GCStats.Initilize", e.ToString());
//		}
//	}
//
//	@Override
//	public String toString() {
//		StringBuilder sb = new StringBuilder();
//
//		if (_initialized) {
//			sb.append("GC Collections -> Gen 0 : " + _gcGen0.NextValue());
//			sb.append(" ;Gen 1 : " + _gcGen1.NextValue());
//			sb.append(" ;Gen 2 : " + _gcGen2.NextValue());
//			sb.append(" <--> % GC time : " + _gcTime.NextValue());
//		}
//
//		return sb.toString();
//	}
}
//#endif




© 2015 - 2024 Weber Informatics LLC | Privacy Policy