Пример #1
0
        private IDictionary <string, JvmPauseMonitor.GcTimes> GetGcTimes()
        {
            IDictionary <string, JvmPauseMonitor.GcTimes> map = Maps.NewHashMap();
            IList <GarbageCollectorMXBean> gcBeans            = ManagementFactory.GetGarbageCollectorMXBeans
                                                                    ();

            foreach (GarbageCollectorMXBean gcBean in gcBeans)
            {
                map[gcBean.GetName()] = new JvmPauseMonitor.GcTimes(gcBean);
            }
            return(map);
        }
Пример #2
0
        private void DoGarbageCollectionUpdates()
        {
            IList <GarbageCollectorMXBean> gcBeans = ManagementFactory.GetGarbageCollectorMXBeans
                                                         ();
            long count      = 0;
            long timeMillis = 0;

            foreach (GarbageCollectorMXBean gcBean in gcBeans)
            {
                count      += gcBean.GetCollectionCount();
                timeMillis += gcBean.GetCollectionTime();
            }
            metrics.IncrMetric("gcCount", (int)(count - gcCount));
            metrics.IncrMetric("gcTimeMillis", (int)(timeMillis - gcTimeMillis));
            gcCount      = count;
            gcTimeMillis = timeMillis;
        }