private void CreateNewBenchMark(string liveAlgo, Benchmark.Setup liveSetup) { long unixTimeStamp = UnixTimeStamp(); Benchmark benchmark = new Benchmark { TimeStamp = unixTimeStamp, Algorithm = liveAlgo, MinerSetup = liveSetup, TimeStarted = UnixTimeStamp(), HashLogs = new HashSet <Benchmark.HashEntry>(), SensorLog = new List <Benchmark.SensorValue>(), Statistics = new List <Benchmark.GpuStat>(), AvailableTimeStamps = new List <Benchmark.Availability>() }; // Makes all the old benchmarks with the same algo inactive foreach (Benchmark benchLog in BenchLogs) { if (benchLog.Algorithm == liveAlgo) { ChangeAvailability(false, benchmark: benchLog); } } BenchLogs.Add(benchmark); }
public void Update(Dictionary <string, string>[][] allApiResults, int[] pingTimes) { Dictionary <string, string>[] history = allApiResults[3]; Dictionary <string, string>[] summary = allApiResults[0]; Dictionary <string, string>[] poolInfo = allApiResults[1]; Dictionary <string, string>[] totalHwInfo = allApiResults[2]; Dictionary <string, string> rightHwInfo = new Dictionary <string, string>(); foreach (Dictionary <string, string> hwInfo in totalHwInfo) { if (Info.Bus == PruvotApi.GetDictValue <int>(hwInfo, "BUS")) { rightHwInfo = hwInfo; break; } } string liveAlgo = PruvotApi.GetDictValue <string>(summary[0], "ALGO"); Benchmark currentBenchmark = GetCurrentBenchmark(liveAlgo); Benchmark.Setup liveSetup = GetLiveSetup(rightHwInfo, totalHwInfo[totalHwInfo.Length - 1], summary, poolInfo); // If currentBenchmark remained null because of an unknown algo,new install or change of setup, // It will create a new benchmark and update again if (currentBenchmark != null && liveSetup.Equals(currentBenchmark.MinerSetup)) { Benchmark.Availability availability = currentBenchmark.AvailableTimeStamps.LastOrDefault(); if (availability != null && availability.Available == false) { ChangeAvailability(true, availability.RequestedByClose, CurrentBenchmark); } if (currentBenchmark != CurrentBenchmark) { ChangeAvailability(false, false, CurrentBenchmark); CurrentBenchmark = currentBenchmark; } UpdateSensors(rightHwInfo, pingTimes); UpdateHashLog(history); UpdateStats(); // Calculates the statistics from previous information } else { CreateNewBenchMark(liveAlgo, liveSetup); Update(allApiResults, pingTimes); } }
private static Benchmark.Setup GetLiveSetup(Dictionary <string, string> hwInfo, Dictionary <string, string> setupInfo, Dictionary <string, string>[] summary, Dictionary <string, string>[] poolInfo) { Benchmark.Setup minerSetup = new Benchmark.Setup { MinerName = PruvotApi.GetDictValue(summary[0], "NAME"), MinerVersion = PruvotApi.GetDictValue(summary[0], "VER"), ApiVersion = PruvotApi.GetDictValue(summary[0], "API"), MiningUrl = poolInfo.Length > 0 ? PruvotApi.GetDictValue(poolInfo[0], "URL"): string.Empty, //Intensity = PruvotApi.GetDictValue<decimal>(hwInfo, "I"), PerformanceState = PruvotApi.GetDictValue(hwInfo, "PST"), BiosVersion = PruvotApi.GetDictValue(hwInfo, "BIOS"), DriverVersion = PruvotApi.GetDictValue(setupInfo, "NVDRIVER"), OperatingSystem = PruvotApi.GetDictValue(setupInfo, "OS"), }; return(minerSetup); }