public static string PGPUUtilisationString(PGPU pGpu, MetricUpdater MetricUpdater) { PCI pci = pGpu.Connection.Resolve(pGpu.PCI); Host host = pGpu.Connection.Resolve(pGpu.host); string pci_id = pci.pci_id.Replace(@":", "/"); double utilisation = MetricUpdater.GetValue(host, String.Format("gpu_utilisation_computer_{0}", pci_id)); if (utilisation == 0 || Double.IsNaN(utilisation) || Double.IsNaN(utilisation)) { return(Messages.HYPHEN); } else { return(utilisation.ToString()); } }
public static string PGPUPowerUsageString(PGPU pGpu, MetricUpdater MetricUpdater) { PCI pci = pGpu.Connection.Resolve(pGpu.PCI); string pci_id = pci.pci_id.Replace(@":", "/"); Host host = pGpu.Connection.Resolve(pGpu.host); double powerUsage = MetricUpdater.GetValue(host, String.Format("gpu_power_usage_{0}", pci_id)); if (powerUsage == 0 || Double.IsNaN(powerUsage) || Double.IsNaN(powerUsage)) { return(Messages.HYPHEN); } else { return(powerUsage.ToString()); } }
public void RefreshGpu(PGPU pGpu) { Program.AssertOnEventThread(); if (!Visible) { return; } GpuShinyBar gpuShinyBar = FindGpuShinyBar(pGpu); if (gpuShinyBar != null) { gpuShinyBar.Initialize(pGpu); gpuShinyBar.Refresh(); } }
public static string PGPUMemoryUsageString(PGPU pGpu, MetricUpdater MetricUpdater) { PCI pci = pGpu.Connection.Resolve(pGpu.PCI); string pci_id = pci.pci_id.Replace(@":", "/"); Host host = pGpu.Connection.Resolve(pGpu.host); double free = MetricUpdater.GetValue(host, String.Format("gpu_memory_free_{0}", pci_id)); double used = MetricUpdater.GetValue(host, String.Format("gpu_memory_used_{0}", pci_id)); double total = free + used; if (total == 0 || Double.IsNaN(total) || Double.IsNaN(free)) { return(Messages.HYPHEN); } else { return(String.Format(Messages.QUERY_MEMORY_USAGE, (used / (free + used) * 100).ToString("0.") + "%", Util.MemorySizeString(free + used))); } }
protected override void Run() { this.Description = Messages.UPDATING_PROPERTIES; RelatedTask = enable ? Host.async_enable_display(Session, Host.opaque_ref) : Host.async_disable_display(Session, Host.opaque_ref); PollToCompletion(0, 50); var pGpu = Host.SystemDisplayDevice; if (pGpu != null) { RelatedTask = enable ? PGPU.async_enable_dom0_access(Session, pGpu.opaque_ref) : PGPU.async_disable_dom0_access(Session, pGpu.opaque_ref); PollToCompletion(50, 100); } PercentComplete = 100; Description = Messages.UPDATED_PROPERTIES; }
private void RepopulateAllowedTypes(PGPU pGpu) { allowedTypesGrid.SuspendLayout(); allowedTypesGrid.Rows.Clear(); allowedTypesGrid.Cursor = Cursors.WaitCursor; try { allowedTypesGrid.Rows.Clear(); if (pGpu.supported_VGPU_types != null && pGpu.supported_VGPU_types.Count > 0) { allowedTypesGrid.Rows.AddRange((from vGpuTypeRef in pGpu.supported_VGPU_types let vGpuType = pGpu.Connection.Resolve(vGpuTypeRef) let enabledType = pGpu.enabled_VGPU_types.Contains(vGpuTypeRef) orderby vGpuType descending select new VGpuTypeRow(vGpuType, enabledType)).ToArray()); } allowedTypesGrid.Height = allowedTypesGrid.Rows[0].Height * (allowedTypesGrid.RowCount); } finally { allowedTypesGrid.ResumeLayout(); allowedTypesGrid.Cursor = Cursors.Default; } }
private void UnregisterPgpuHandlers(PGPU pgpu) { pgpu.PropertyChanged -= pgpu_PropertyChanged; }
private GpuRow FindRow(PGPU pgpu) { return(pgpu != null?pageContainerPanel.Controls.OfType <GpuRow>().FirstOrDefault(row => row.PGPUs.Contains(pgpu)) : null); }