private void UpdateSensorStats() { int count; decimal totalTemp = 0, totalPing = 0; for (count = 0; count < CurrentBenchmark.SensorLog.Count; count++) { Benchmark.SensorValue sensorValue = CurrentBenchmark.SensorLog[count]; totalTemp += sensorValue.Temperature; totalPing += sensorValue.ShareAnswerPing; } Benchmark.GpuStat currentStat = CurrentBenchmark.CurrentStatistic; currentStat.AverageTemperature = totalTemp / count; currentStat.AverageShareAnswerPing = Math.Round(totalPing / count, MidpointRounding.AwayFromZero); }
private void UpdateSensors(Dictionary <string, string> hwInfo, int[] pingTimes) { Benchmark.SensorValue sensorValue = new Benchmark.SensorValue { TimeStamp = UnixTimeStamp(), Temperature = PruvotApi.GetDictValue <decimal>(hwInfo, "TEMP"), FanPercentage = PruvotApi.GetDictValue <decimal>(hwInfo, "FAN"), FanRpm = PruvotApi.GetDictValue <decimal>(hwInfo, "RPM"), CoreClockFrequency = PruvotApi.GetDictValue <decimal>(hwInfo, "FREQ"), MemoryClockFrequency = PruvotApi.GetDictValue <decimal>(hwInfo, "MEMFREQ"), ShareAnswerPing = pingTimes[0], MiningUrlPing = pingTimes[1], NetworkRigPing = pingTimes[2] }; CurrentBenchmark.SensorLog.Add(sensorValue); }