Esempio n. 1
0
        private void DoMemoryUpdates()
        {
            MemoryMXBean memoryMXBean = ManagementFactory.GetMemoryMXBean();
            MemoryUsage  memNonHeap   = memoryMXBean.GetNonHeapMemoryUsage();
            MemoryUsage  memHeap      = memoryMXBean.GetHeapMemoryUsage();
            Runtime      runtime      = Runtime.GetRuntime();

            metrics.SetMetric("memNonHeapUsedM", memNonHeap.GetUsed() / M);
            metrics.SetMetric("memNonHeapCommittedM", memNonHeap.GetCommitted() / M);
            metrics.SetMetric("memHeapUsedM", memHeap.GetUsed() / M);
            metrics.SetMetric("memHeapCommittedM", memHeap.GetCommitted() / M);
            metrics.SetMetric("maxMemoryM", runtime.MaxMemory() / M);
        }