private Dictionary <string, TRexSummary> GetWorkerStats(List <Machine> machines, bool reloadTree = true) { Dictionary <string, TRexSummary> workerStats = new Dictionary <string, TRexSummary>(); foreach (var machine in machines) { try { TRexSummary workerInfo = null; if (machine.Enabled) { workerInfo = TRexAPI.GetFullSummary(machine.Host); } workerStats.Add(machine.ToString(), workerInfo); if (workerInfo == null) { continue; } } catch { workerStats.Add($"{machine} - OFFLINE", new TRexSummary()); machine.Enabled = false; } } if (reloadTree) { workerTree.Nodes.Clear(); foreach (var workerStat in workerStats) { if (workerStat.Value == null) { continue; } var workerNode = workerTree.Nodes.Add(workerStat.Key); if (workerTree.SelectedNode == null) { workerTree.SelectedNode = workerNode; } if (workerStat.Value.gpus != null) { foreach (var gpu in workerStat.Value.gpus) { workerNode.Nodes.Add($"{gpu.vendor} {gpu.name}: Hash={(gpu.hashrate / 1000000d):0.00}MH/s Temp={gpu.temperature}°C Power={gpu.power}W Efficiency={gpu.efficiency}"); } } workerNode.Expand(); } } return(workerStats); }
public static TRexSummary GetFullSummary(string endPointIP, int endPointPort = 4067) { TRexSummary trexSummary = null; using (HttpClient httpClient = new HttpClient()) { var request = $"http://{endPointIP}:{endPointPort}/summary?last-stat-ts=0"; var response = httpClient.GetStringAsync(new Uri(request)).Result; trexSummary = JsonConvert.DeserializeObject <TRexSummary>(response); } return(trexSummary); }
private void DisplayWorkerGraph(TRexSummary workerStat, long minHash, long maxHash, Pen pen = null, bool printTimeStamp = true) { DisplayWorkerGraph(workerStat.velocities.hashrate, minHash, maxHash, pen, printTimeStamp); }