示例#1
0
        private void Update()
        {
            _numMonitors = SystemStats.GetNumMonitors();
            var energy = CorrectEnergyError(SystemStats.GetPowerUsageSinceLastQuery());

            _joulesTotal += energy.joules + GetMonitorJoulesUsed(_numMonitors);
            WriteData(energy);
        }
示例#2
0
 protected override void OnStart(string[] args)
 {
     try
     {
         SystemStats.GetPowerUsageSinceLastQuery();
         SystemStats.GetTDP(0, ref _tdp);
         _timer = new System.Timers.Timer(Settings.Default.TimerInterval * 1000);
         Update();
         _timer.Elapsed += (s, e) =>
         {
             Update();
         };
         _timer.Start();
     }
     catch (Exception e)
     {
         Logging.Log(e.Message);
     }
 }