public HardwareMonitor Get() { string x; CredentialCache credsCache = new CredentialCache(); NetworkCredential myCred = new NetworkCredential(username, password); credsCache.Add(new Uri($"http://{host}:{port}/mahm"), "Basic", myCred); WebRequest request = WebRequest.Create($"http://{host}:{port}/mahm"); request.Credentials = credsCache; //request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { x = reader.ReadToEnd(); } XmlSerializer serializer = new XmlSerializer(typeof(HardwareMonitor)); StringReader rdr = new StringReader(x); HardwareMonitor resultingMessage = (HardwareMonitor)serializer.Deserialize(rdr); return(resultingMessage); }
public Claymore(HardwareType hardwareType, MinerBaseType minerBaseType, HardwareMonitor hardwareMonitor) : base("Claymore", hardwareType, minerBaseType, hardwareMonitor) { MinerWorkingDirectory = Path.Combine(Utils.Core.GetBaseMinersDir(), "Claymore"); MinerFileName = "EthDcrMiner64.exe"; ApiPort = 2882; HostName = "127.0.0.1"; }
public LyclMiner(HardwareType hardwareType, MinerBaseType minerBaseType, HardwareMonitor hardwareMonitor, bool is64Bit) : base("LyclMiner", hardwareType, minerBaseType, hardwareMonitor, is64Bit) { MinerWorkingDirectory = Path.Combine(Utils.Core.GetBaseMinersDir(), "LyclMiner015"); MinerFileName = "lyclMiner.exe"; ApiPort = 4028; HostName = "127.0.0.1"; }
public DSTM(HardwareType hardwareType, MinerBaseType minerBaseType, HardwareMonitor hardwareMonitor) : base("DSTM", hardwareType, minerBaseType, hardwareMonitor) { MinerWorkingDirectory = Path.Combine(Utils.Core.GetBaseMinersDir(), "DSTM"); MinerFileName = "zm.exe"; ApiPort = 2222; HostName = "127.0.0.1"; }
public EWBF(HardwareType hardwareType, MinerBaseType minerBaseType, HardwareMonitor hardwareMonitor) : base("EWBF", hardwareType, minerBaseType, hardwareMonitor) { MinerWorkingDirectory = Path.Combine(Utils.Core.GetBaseMinersDir(), "EWBF"); MinerFileName = "miner.exe"; ApiPort = 42000; HostName = "127.0.0.1"; }
private void StartServer() { try { // Connect to HardwareMonitor shared memory var hardwareMonitor = new HardwareMonitor(); // Start the server _server = new Server(hardwareMonitor); _server.StartServer(); Program.ServerIsAlive = true; lbServerStatus.Text = "Server broadcasting at " + _server.IPAddress; } catch (SharedMemoryNotFound) { lbServerStatus.Text = "Could not find MSI Afterburner"; } catch { lbServerStatus.Text = "Server initialization failed"; } }
// from the core temp demo code private void RefreshInfo_Elapsed(object sender, ElapsedEventArgs e) { //Attempt to read shared memory. bool bReadSuccess = CTInfo.GetData(); if (bReadSuccess) { uint index; float maxT = 1.0f; int load = 0; // get max and avg load for all cpu's + cores for (uint i = 0; i < CTInfo.GetCPUCount; i++) { for (uint g = 0; g < CTInfo.GetCoreCount; g++) { index = g + (i * CTInfo.GetCoreCount); if (!CTInfo.IsDistanceToTjMax) { if (maxT <= CTInfo.GetTemp[index]) { maxT = CTInfo.GetTemp[index]; } load += (int)CTInfo.GetCoreLoad[index]; } } } //date string string datePatt = @"HH:mm"; DateTime saveNow = DateTime.Now; DateTime myDt; myDt = DateTime.SpecifyKind(saveNow, DateTimeKind.Local); string dtString; // setup output string // Core Speed, Core Temp, Max Core Temp, Time, Average Load, // #.#Ghz,#.#,##:##,### dtString = myDt.ToString(datePatt); HardwareMonitor mahm = new HardwareMonitor(); //String output = Math.Round((CTInfo.GetCPUSpeed / 1000), 1) + "Ghz" + ";" + Math.Round(maxT, 1) + ";" + dtString + ";" + +((int)(load / CTInfo.GetCoreCount)); //String output = "RAM:" + (((totalRam - getAvailableRAM()) * 100 / totalRam)) + "%" + ";" + Math.Round(maxT, 1) + ";" + dtString + ";" + +((int)(load / CTInfo.GetCoreCount)); //CPU String output = "0:" + mahm.Entries[0].Data.ToString() + "C;1:" + mahm.Entries[1].Data.ToString() + "C;" + (((totalRam - getAvailableRAM()) * 100 / totalRam)) + ";" + Math.Round(maxT, 0) + "C;" + mahm.Entries[2].Data.ToString() + ";" + ((int)(load / CTInfo.GetCoreCount)); //update tooltip icon ACTnotf.Text = "Module Running - " + output; // write com if avail if not notify if (comPort.IsOpen) { try{ comPort.WriteLine(output); } catch (System.IO.IOException argEx) { } try { this.Invoke((MethodInvoker) delegate { // added ram to display not to string as arduino is not updated to show it yet. //tbConsole.Text = output + ";" + getAvailableRAM() + ";" + totalRam + ";" + ((getAvailableRAM() * 100 / totalRam))+"%"; // runs on UI thread tbConsole.Text = output; // modificado }); } catch (Exception excp) { } } else // no com available { try { this.Invoke((MethodInvoker) delegate { tbConsole.Text = "Com port not available"; // runs on UI thread }); } catch (Exception excp) { } } } else // coretemp not avail { this.Invoke((MethodInvoker) delegate { tbConsole.Text = CTInfo.GetErrorMessage(CTInfo.GetLastError); // runs on UI thread }); } }
public MinerFactory(HardwareMonitor hardwareMonitor) { this.hardwareMonitor = hardwareMonitor; }
static void Main(string[] args) { Console.Clear(); Console.TreatControlCAsInput = false; Console.CancelKeyPress += (s, e) => { Console.WriteLine("ctrl+c pressed"); Continue = false; e.Cancel = true; }; try { // connect to MACM shared memory HardwareMonitor mahm = new HardwareMonitor(); // print out current MACM Header values Console.WriteLine("***** MSI AFTERTERBURNER HARDWARE MONITOR HEADER *****"); Console.WriteLine(mahm.Header.ToString().Replace(";", "\n")); Console.WriteLine(); // print out current MAHM GPU Entry values for (int i = 0; i < mahm.Header.GpuEntryCount; i++) { Console.WriteLine("***** MSI AFTERTERBURNER GPU " + i + " *****"); Console.WriteLine(mahm.GpuEntries[i].ToString().Replace(";", "\n")); Console.WriteLine(); } // print out current Entry values for (int i = 0; i < mahm.Header.EntryCount; i++) { if (mahm.Entries[i].SrcName == "CPU usage") { if (cpuUsageIndex == -1) { cpuUsageIndex = i; } } else if (mahm.Entries[i].SrcName == "CPU1 temperature") { if (cpuTempIndex == -1) { cpuTempIndex = i; } } else if (mahm.Entries[i].SrcName == "GPU temperature") { if (gpuTempIndex == -1) { gpuTempIndex = i; } } else if (mahm.Entries[i].SrcName == "Framerate") { if (framerateIndex == -1) { framerateIndex = i; } } else if (mahm.Entries[i].SrcName == "Power") { if (powerIndex == -1) { powerIndex = i; } } else if (mahm.Entries[i].SrcName == "GPU usage") { if (gpuUsageIndex == -1) { gpuUsageIndex = i; } } else if (mahm.Entries[i].SrcName == "Memory usage") { if (memoryUsageIndex == -1) { memoryUsageIndex = i; } } else if (mahm.Entries[i].SrcName == "RAM usage") { if (ramUsageIndex == -1) { ramUsageIndex = i; } } Console.WriteLine("***** MSI AFTERTERBURNER DATA SOURCE " + i + " *****"); Console.WriteLine(mahm.Entries[i].ToString().Replace(";", "\n")); Console.WriteLine(); } Console.WriteLine(mahm.Entries.Length); Console.WriteLine("Enter arduino COM port:"); String comPort = Console.ReadLine(); Console.WriteLine("Enter arduino baudRate:"); int baudRate = Int32.Parse(Console.ReadLine()); Arduino arduino = new Arduino(); arduino.Connect(comPort, baudRate); // show a data source monitor several times HardwareMonitorEntry cpuUsageEntry = mahm.Entries[cpuUsageIndex]; HardwareMonitorEntry cpuTempEntry = mahm.Entries[cpuTempIndex]; HardwareMonitorEntry gpuTempEntry = mahm.Entries[gpuTempIndex]; //mahm.GetEntry(0, MONITORING_SOURCE_ID.GPU_TEMPERATURE); HardwareMonitorEntry framerateEntry = mahm.Entries[framerateIndex]; //mahm.GetEntry(HardwareMonitor.GPU_GLOBAL_INDEX, MONITORING_SOURCE_ID.FRAMERATE); HardwareMonitorEntry powerEntry = mahm.Entries[powerIndex]; HardwareMonitorEntry gpuUsageEntry = mahm.Entries[gpuUsageIndex]; HardwareMonitorEntry memoryUsageEntry = mahm.Entries[memoryUsageIndex]; HardwareMonitorEntry ramUsageEntry = mahm.Entries[ramUsageIndex]; if (framerateEntry != null && cpuUsageEntry != null && cpuTempEntry != null && gpuTempEntry != null) { byte[] data = new byte[16]; UInt16 cpuUsage, gpuUsage, cpuTemp, gpuTemp, memoryUsage, ramUsage, framerate, powerUsage; while (Continue) { cpuUsage = (UInt16)cpuUsageEntry.Data; gpuUsage = (UInt16)gpuUsageEntry.Data; cpuTemp = (UInt16)cpuTempEntry.Data; gpuTemp = (UInt16)gpuTempEntry.Data; memoryUsage = (UInt16)memoryUsageEntry.Data; ramUsage = (UInt16)ramUsageEntry.Data; framerate = (UInt16)framerateEntry.Data; powerUsage = (UInt16)powerEntry.Data; data[0] = (byte)(cpuUsage >> 8); data[1] = (byte)(cpuUsage); data[2] = (byte)(gpuUsage >> 8); data[3] = (byte)(gpuUsage); data[4] = (byte)(cpuTemp >> 8); data[5] = (byte)(cpuTemp); data[6] = (byte)(gpuTemp >> 8); data[7] = (byte)(gpuTemp); data[8] = (byte)(memoryUsage >> 8); data[9] = (byte)(memoryUsage); data[10] = (byte)(ramUsage >> 8); data[11] = (byte)(ramUsage); data[12] = (byte)(framerate >> 8); data[13] = (byte)(framerate); data[14] = (byte)(powerUsage >> 8); data[15] = (byte)(powerUsage); arduino.write(data, 0, 16); System.Threading.Thread.Sleep(500); mahm.ReloadEntry(cpuUsageEntry); mahm.ReloadEntry(gpuUsageEntry); mahm.ReloadEntry(cpuTempEntry); mahm.ReloadEntry(gpuTempEntry); mahm.ReloadEntry(memoryUsageEntry); mahm.ReloadEntry(ramUsageEntry); mahm.ReloadEntry(framerateEntry); mahm.ReloadEntry(powerEntry); } } Console.WriteLine("Closing arduino connection!"); arduino.close(); } catch (Exception e) { Console.WriteLine(e.Message); if (e.InnerException != null) { Console.WriteLine(e.InnerException.Message); } } Console.WriteLine("\nPress any key to exit"); Console.ReadKey(); }
public CCMinerForkNanashi(HardwareType hardwareType, MinerBaseType minerBaseType, HardwareMonitor hardwareMonitor) : base(hardwareType, minerBaseType, hardwareMonitor, false) { string versionedDirectory = ""; MinerFileName = "ccminer.exe"; versionedDirectory = "ccminer-2.2-mod-r2"; MinerWorkingDirectory = Path.Combine(Utils.Core.GetBaseMinersDir(), versionedDirectory); ApiPort = 4093; HostName = "127.0.0.1"; }
public Server(HardwareMonitor hardwareMonitor) { _hardwareMonitor = hardwareMonitor; IPAddress = GetLocalIPAddress(); }
private bool Testmab(int i) { bool result = true; AppExtControl aec = new AppExtControl("", AppExtOperation.Connect, 10000, 2000); string s = i.ToString() + ". (" + DateTime.Now + "): "; s += "exeApp1.Start = "; try { s += MSIAB.Start(txtMSIABFile.Text, "-Profile1", aec).ToString() + "; "; } catch (Exception e) { s += e.Message + "; "; result = false; } System.Threading.Thread.Sleep(5000); s += "new ControlMemory() = "; try { macm = new ControlMemory(); s += "Ok; "; } catch (Exception e) { s += e.Message + "; "; result = false; } s += "new HardwareMonitor() = "; try { mahm = new HardwareMonitor(); s += "Ok; "; } catch (Exception e) { s += e.Message + "; "; result = false; } System.Threading.Thread.Sleep(8000); s += "Close = " + MSIAB.Close(2000).ToString() + "; "; System.Threading.Thread.Sleep(2000); StreamWriter file; file = new StreamWriter(CommonProc.ApplicationExePath + "log.txt", i != 0); file.Write(s + Environment.NewLine); file.Close(); Wr(s); return(result); }
//private void a private bool ShowMsiState() { txtLog.Clear(); //lvMsi.Items.Clear(); //lvMsi.Clear(); int normalColumnWidth = 20; dgvMSI.Rows.Clear(); dgvMSI.Columns.Clear(); dgvMSI.AutoGenerateColumns = false; dgvMSI.RowHeadersVisible = false; dgvMSI.MultiSelect = false; dgvMSI.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvMSI.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; dgvMSI.DefaultCellStyle.WrapMode = DataGridViewTriState.True; //dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() {HeaderText = "Index", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, FillWeight = normalColumnWidth }); //dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() {HeaderText = "Device", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, FillWeight = normalColumnWidth }); //dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() {HeaderText = "GpuId", ReadOnly = true, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "Index", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "Device", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "GpuId", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "Val", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "FanSpeed", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "CoreClock", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "ShaderClock", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "MemoryClock", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "CoreVoltage", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "MemoryVoltage", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "AuxVoltage", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "CoreVoltageBoost", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "MemoryVoltageBoost", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "AuxVoltageBoost", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "PowerLimit", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "CoreClockBoost", ReadOnly = true, FillWeight = normalColumnWidth }); dgvMSI.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "MemoryClockBoost", ReadOnly = true, FillWeight = normalColumnWidth }); //lvMsi.Columns.Add("Index", normalColumnWidth); //lvMsi.Columns.Add("Device", normalColumnWidth); //lvMsi.Columns.Add("GpuId", normalColumnWidth); //foreach (ColumnHeader cl in lvMsi.Columns) //{ // //cl. //} bool result = true; try { if (macm == null) { macm = new ControlMemory(); } else { macm.Disconnect(); macm.Connect(); } } catch (Exception e) { Wr(e.Message); result = false; //return false; } try { if (mahm == null) { mahm = new HardwareMonitor(); } else { mahm.Disconnect(); mahm.Connect(); } } catch (Exception e) { Wr(e.Message); result = false; //return false; } if (!result) { return(result); } for (int i = 0; i < mahm.Header.GpuEntryCount; i++) { //wr("***** MSI AFTERTERBURNER GPU " + i + " *****"); ControlMemoryGpuEntry ge = macm.GpuEntries[i]; dgvMSI.Rows.Add(new String[] { i.ToString(), mahm.GpuEntries[i].Index.ToString(), mahm.GpuEntries[i].Device, mahm.GpuEntries[i].GpuId, "Cur:" + "\n" + "Min:" + "\n" + "Max:" + "\n" + "Def:", ge.FanSpeedCur.ToString() + "\n" + ge.FanSpeedMin.ToString() + "\n" + ge.FanSpeedMax.ToString() + "\n" + ge.FanSpeedDef.ToString(), ge.CoreClockCur.ToString() + "\n" + ge.CoreClockMin.ToString() + "\n" + ge.CoreClockMax.ToString() + "\n" + ge.CoreClockDef.ToString(), ge.ShaderClockCur.ToString() + "\n" + ge.ShaderClockMin.ToString() + "\n" + ge.ShaderClockMax.ToString() + "\n" + ge.ShaderClockDef.ToString(), ge.MemoryClockCur.ToString() + "\n" + ge.MemoryClockMin.ToString() + "\n" + ge.MemoryClockMax.ToString() + "\n" + ge.MemoryClockDef.ToString(), ge.CoreVoltageCur.ToString() + "\n" + ge.CoreVoltageMin.ToString() + "\n" + ge.CoreVoltageMax.ToString() + "\n" + ge.CoreVoltageDef.ToString(), ge.MemoryVoltageCur.ToString() + "\n" + ge.MemoryVoltageMin.ToString() + "\n" + ge.MemoryVoltageMax.ToString() + "\n" + ge.MemoryVoltageDef.ToString(), ge.AuxVoltageCur.ToString() + "\n" + ge.AuxVoltageMin.ToString() + "\n" + ge.AuxVoltageMax.ToString() + "\n" + ge.AuxVoltageDef.ToString(), ge.CoreVoltageBoostCur.ToString() + "\n" + ge.CoreVoltageBoostMin.ToString() + "\n" + ge.CoreVoltageBoostMax.ToString() + "\n" + ge.CoreVoltageBoostDef.ToString(), ge.MemoryVoltageBoostCur.ToString() + "\n" + ge.MemoryVoltageBoostMin.ToString() + "\n" + ge.MemoryVoltageBoostMax.ToString() + "\n" + ge.MemoryVoltageBoostDef.ToString(), ge.AuxVoltageBoostCur.ToString() + "\n" + ge.AuxVoltageBoostMin.ToString() + "\n" + ge.AuxVoltageBoostMax.ToString() + "\n" + ge.AuxVoltageBoostDef.ToString(), ge.PowerLimitCur.ToString() + "\n" + ge.PowerLimitMin.ToString() + "\n" + ge.PowerLimitMax.ToString() + "\n" + ge.PowerLimitDef.ToString(), ge.CoreClockBoostCur.ToString() + "\n" + ge.CoreClockBoostMin.ToString() + "\n" + ge.CoreClockBoostMax.ToString() + "\n" + ge.CoreClockBoostDef.ToString(), ge.MemoryClockBoostCur.ToString() + "\n" + ge.MemoryClockBoostMin.ToString() + "\n" + ge.MemoryClockBoostMax.ToString() + "\n" + ge.MemoryClockBoostDef.ToString() }); //ListViewItem li = lvMsi.Items.Add(mahm.GpuEntries[i].Index.ToString()); //li.SubItems.Add(mahm.GpuEntries[i].Device); //li.SubItems.Add(mahm.GpuEntries[i].GpuId); //li.SubItems.Add(mahm.Entries[i].); } Wr("***** macm.Header.MasterGpu " + macm.Header.MasterGpu.ToString()); Wr(); for (int i = 0; i < macm.Header.GpuEntryCount; i++) { Wr("***** MSI AFTERTERBURNER GPU " + i + " *****"); Wr("Index: " + macm.GpuEntries[i].Index.ToString()); Wr(macm.GpuEntries[i].ToString().Replace(";", Environment.NewLine)); Wr(); } Wr(); Wr("****************************************************************"); Wr(); for (int i = 0; i < mahm.Header.EntryCount; i++) { Wr("***** MSI AFTERTERBURNER DATA SOURCE " + i + " *****"); Wr(mahm.Entries[i].ToString());//.Replace(";", "\n")); Wr(); } return(true); }