-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
288 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GPUControl.Lib.GPU | ||
{ | ||
public interface IDeviceInfo | ||
{ | ||
string ArchitectureName { get; } | ||
string PciBusInfo { get; } | ||
string BiosVersion { get; } | ||
int NumCores { get; } | ||
int NumRops { get; } | ||
int NumConnectedDisplays { get; } | ||
int NumAvailableConnections { get; } | ||
int VramSizeMB { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GPUControl.Lib.GPU | ||
{ | ||
public interface IUtilizationInfo | ||
{ | ||
string CurrentPerformanceState { get; } | ||
|
||
string PerformanceLimit { get; } | ||
uint BusUsagePercent { get; } | ||
uint MemoryUsagePercent { get; } | ||
uint GpuUsagePercent { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GPUControl.Lib.GPU.mockimpl | ||
{ | ||
public class MockDeviceInfo : IDeviceInfo | ||
{ | ||
public string ArchitectureName => "Mock"; | ||
public string PciBusInfo => "PCI Express Bus #0 Slot #10"; | ||
|
||
public string BiosVersion => "100.90.80.70.60"; | ||
|
||
public int NumCores => 4096; | ||
|
||
public int NumRops => 32; | ||
|
||
public int NumConnectedDisplays => 2; | ||
|
||
public int NumAvailableConnections => 12; | ||
|
||
public int VramSizeMB => 12000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GPUControl.Lib.GPU.mockimpl | ||
{ | ||
public class MockUtilizationInfo : IUtilizationInfo | ||
{ | ||
public string CurrentPerformanceState => "P0"; | ||
|
||
public string PerformanceLimit => "No Limit"; | ||
|
||
|
||
public uint BusUsagePercent => (uint)MockValueProvider.Percent.Value; | ||
|
||
public uint MemoryUsagePercent => (uint)MockValueProvider.Percent.Value; | ||
|
||
public uint GpuUsagePercent => (uint)MockValueProvider.Percent.Value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using NvAPIWrapper.GPU; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace GPUControl.Lib.GPU.nvidiaimpl | ||
{ | ||
public class NvidiaDeviceInfo : IDeviceInfo | ||
{ | ||
PhysicalGPU gpu; | ||
|
||
public NvidiaDeviceInfo(PhysicalGPU gpu) | ||
{ | ||
this.gpu = gpu; | ||
} | ||
|
||
public string ArchitectureName => gpu.ArchitectInformation.ShortName; | ||
|
||
public string PciBusInfo | ||
{ | ||
get | ||
{ | ||
var info = gpu.BusInformation; | ||
return $"{info.BusType} Bus #{info.BusId}, Slot #{info.BusSlot}, x{info.CurrentPCIeLanes} mode"; | ||
} | ||
} | ||
|
||
public string BiosVersion => gpu.Bios.VersionString; | ||
|
||
public int NumCores => gpu.ArchitectInformation.NumberOfCores; | ||
|
||
public int NumRops => gpu.ArchitectInformation.NumberOfROPs; | ||
|
||
public int NumConnectedDisplays => gpu.ActiveOutputs.Length; | ||
|
||
public int NumAvailableConnections => gpu.GetDisplayDevices().Length; | ||
|
||
public int VramSizeMB => gpu.MemoryInformation.PhysicalFrameBufferSizeInkB / 1024; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using NvAPIWrapper.GPU; | ||
|
||
namespace GPUControl.Lib.GPU.nvidiaimpl | ||
{ | ||
public class NvidiaUtilizationInfo : IUtilizationInfo | ||
{ | ||
PhysicalGPU gpu; | ||
|
||
public NvidiaUtilizationInfo(PhysicalGPU gpu) | ||
{ | ||
this.gpu = gpu; | ||
} | ||
|
||
public string CurrentPerformanceState => gpu.PerformanceStatesInfo.CurrentPerformanceState.StateId.ToString(); | ||
|
||
public string PerformanceLimit => gpu.PerformanceControl.CurrentActiveLimit.ToString(); | ||
|
||
public uint BusUsagePercent => (uint)gpu.UsageInformation.BusInterface.Percentage; | ||
|
||
public uint MemoryUsagePercent => (uint)gpu.UsageInformation.FrameBuffer.Percentage; | ||
|
||
public uint GpuUsagePercent => (uint)gpu.UsageInformation.GPU.Percentage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.