using System;

namespace skyscraper5.Skyscraper.Webserver.Metrics
{
    internal class SystemMetricCollector
    {
        private SystemMetricCollector()
        {
        }

        private static SystemMetricCollector _instance;

        public static SystemMetricCollector GetInstance()
        {
            if (_instance == null)
            {
                _instance = new SystemMetricCollector();
            }

            return _instance;
        }

        [MetricType(MetricType.Gauge)]
        public int CurrentManagedThreadId => Environment.CurrentManagedThreadId;

        [MetricType(MetricType.Gauge)]
        public int ExitCode => Environment.ExitCode;

        [MetricType(MetricType.Gauge)]
        public int ProcessId => Environment.ProcessId;

        [MetricType(MetricType.Gauge)]
        public int ProcessorCount => Environment.ProcessorCount;

        [MetricType(MetricType.Gauge)]
        public int SystemPageSize => Environment.SystemPageSize;

        [MetricType(MetricType.Gauge)]
        public int TickCount => Environment.TickCount;

        [MetricType(MetricType.Gauge)]
        public long TickCount64 => Environment.TickCount64;

        [MetricType(MetricType.Gauge)]
        public long WorkingSet => Environment.WorkingSet;

        [MetricType(MetricType.Gauge)] 
        public int GcMaxGeneration => GC.MaxGeneration;
    }
}
