private void Update() { _numMonitors = SystemStats.GetNumMonitors(); var energy = CorrectEnergyError(SystemStats.GetPowerUsageSinceLastQuery()); _joulesTotal += energy.joules + GetMonitorJoulesUsed(_numMonitors); WriteData(energy); }
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); } }