Skip to content

Commit

Permalink
Merge branch 'release/1.6.7' of https://github.com/CXWorld/CapFrameX
Browse files Browse the repository at this point in the history
…into release/1.6.7
  • Loading branch information
DevtechProfile committed Jan 18, 2022
2 parents aa5b582 + b09df81 commit b81f6de
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 43 deletions.
1 change: 1 addition & 0 deletions source/CapFrameX.Contracts/CapFrameX.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<Compile Include="Overlay\IOverlayService.cs" />
<Compile Include="RTSS\IRTSSService.cs" />
<Compile Include="Sensor\EHardwareType.cs" />
<Compile Include="Sensor\IProcessService.cs" />
<Compile Include="Sensor\ISensorConfig.cs" />
<Compile Include="Sensor\ISensorEntry.cs" />
<Compile Include="Sensor\ISensorService.cs" />
Expand Down
5 changes: 2 additions & 3 deletions source/CapFrameX.Contracts/RTSS/IRTSSService.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using CapFrameX.Contracts.Overlay;
using CapFrameX.Contracts.Sensor;
using System;
using System.Reactive.Subjects;
using System.Threading.Tasks;

namespace CapFrameX.Contracts.RTSS
{
public interface IRTSSService
public interface IRTSSService : IProcessService
{
ISubject<int> ProcessIdStream { get; }
bool IsRTSSInstalled();
string GetApiInfo(int processId);
Tuple<double, double> GetCurrentFramerate(int processId);
Expand Down
9 changes: 9 additions & 0 deletions source/CapFrameX.Contracts/Sensor/IProcessService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Reactive.Subjects;

namespace CapFrameX.Contracts.Sensor
{
public interface IProcessService
{
ISubject<int> ProcessIdStream { get; }
}
}
4 changes: 2 additions & 2 deletions source/CapFrameX.Data/ReportInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class ReportInfo
[DisplayName("Creation time")]
public string Time { get; set; }
[DisplayName("# samples")]
public string NumberOfSamples {get; set; }
public int NumberOfSamples {get; set; }
[DisplayName("Record time (s)")]
public string RecordTime { get; set; }
public double RecordTime { get; set; }
[DisplayName("CPU Name")]
public string Cpu { get; set; }
[DisplayName("GPU Name")]
Expand Down
6 changes: 3 additions & 3 deletions source/CapFrameX.ViewModel/ReportViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private void OnCopyTableData()
(ShowCreationDate ? "\t" + reportInfo.Date?.ToString(cultureInfo) : "") +
(ShowCreationTime ? "\t" + reportInfo.Time?.ToString(cultureInfo) : "") +
(ShowNumberOfSamples ? "\t" + reportInfo.NumberOfSamples : "") +
(ShowRecordTime ? "\t" + reportInfo.RecordTime?.ToString(cultureInfo) : "") +
(ShowRecordTime ? "\t" + reportInfo.RecordTime : "") +
(ShowCpuName ? "\t" + reportInfo.Cpu : "") +
(ShowGpuName ? "\t" + reportInfo.GraphicCard : "") +
(ShowRamName ? "\t" + reportInfo.Ram : "") +
Expand Down Expand Up @@ -300,8 +300,8 @@ double GeMetricValue(IList<double> sequence, EMetric metric) =>
Game = recordInfo.GameName,
Date = recordInfo.CreationDate,
Time = recordInfo.CreationTime,
NumberOfSamples = frameTimes.Count.ToString(),
RecordTime = Math.Round(recordTime, 2).ToString(),
NumberOfSamples = frameTimes.Count,
RecordTime = Math.Round(recordTime, 2),
Cpu = recordInfo.ProcessorName == null ? "" : recordInfo.ProcessorName.Trim(new char[] { ' ', '"' }),
GraphicCard = recordInfo.GraphicCardName == null ? "" : recordInfo.GraphicCardName.Trim(new char[] { ' ', '"' }),
Ram = recordInfo.SystemRamInfo == null ? "" : recordInfo.SystemRamInfo.Trim(new char[] { ' ', '"' }),
Expand Down
8 changes: 4 additions & 4 deletions source/OpenHardwareMonitor/Hardware/ATI/ATIGPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ internal sealed class ATIGPU : GPUBase
private readonly int overdriveVersion;

public ATIGPU(string name, int adapterIndex, int busNumber,
int deviceNumber, IntPtr context, ISettings settings, ISensorConfig config, IRTSSService rTSSService)
int deviceNumber, IntPtr context, ISettings settings, ISensorConfig config, IProcessService processService)
: base(name, new Identifier("atigpu",
adapterIndex.ToString(CultureInfo.InvariantCulture)), settings, rTSSService)
adapterIndex.ToString(CultureInfo.InvariantCulture)), settings, processService)
{
this.adapterIndex = adapterIndex;
this.busNumber = busNumber;
Expand Down Expand Up @@ -388,8 +388,8 @@ public override void Update()
}

// Linear fitting function (model)
// TBP = 15W + 1.1 * ASIC Power
powerTotalBoardSimulated.Value = powerTotalValue > 0 ? (float)Math.Round(15f + 1.11f * powerTotalValue, 0) : 0;
// TBP = 5W + 1.155 * ASIC Power
powerTotalBoardSimulated.Value = powerTotalValue > 0 ? (float)Math.Round(5f + 1.155f * powerTotalValue, 0) : 0;
ActivateSensor(powerTotalBoardSimulated);
}

Expand Down
4 changes: 2 additions & 2 deletions source/OpenHardwareMonitor/Hardware/ATI/ATIGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class ATIGroup : IGroup

private IntPtr context = IntPtr.Zero;

public ATIGroup(ISettings settings, ISensorConfig sensorConfig, IRTSSService rTSSService)
public ATIGroup(ISettings settings, ISensorConfig sensorConfig, IProcessService processService)
{
try
{
Expand Down Expand Up @@ -110,7 +110,7 @@ public ATIGroup(ISettings settings, ISensorConfig sensorConfig, IRTSSService rTS
adapterInfo[i].DeviceNumber,
context, settings,
sensorConfig,
rTSSService));
processService));
}

report.AppendLine();
Expand Down
19 changes: 9 additions & 10 deletions source/OpenHardwareMonitor/Hardware/Computer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ This Source Code Form is subject to the terms of the Mozilla Public

namespace OpenHardwareMonitor.Hardware
{

public class Computer : IComputer
{
private readonly List<IGroup> groups = new List<IGroup>();
private readonly ISettings settings;
private readonly ISensorConfig sensorConfig;
private readonly IRTSSService rTSSService;
private readonly IProcessService processService;

private SMBIOS smbios;

Expand All @@ -38,12 +37,12 @@ public class Computer : IComputer
private bool hddEnabled;

#pragma warning disable CS3001 // Argumenttyp ist nicht CLS-kompatibel
public Computer(ISensorConfig config, IRTSSService service)
public Computer(ISensorConfig config, IProcessService processService)
#pragma warning restore CS3001 // Argumenttyp ist nicht CLS-kompatibel
{
this.settings = new Settings();
sensorConfig = config;
rTSSService = service;
this.processService = processService;
}

private void Add(IGroup group)
Expand Down Expand Up @@ -100,12 +99,12 @@ public void Open()
Add(new CPU.CPUGroup(settings, sensorConfig));

if (ramEnabled)
Add(new RAM.RAMGroup(settings, sensorConfig, rTSSService));
Add(new RAM.RAMGroup(settings, sensorConfig, processService));

if (gpuEnabled)
{
Add(new ATI.ATIGroup(settings, sensorConfig, rTSSService));
Add(new Nvidia.NvidiaGroup(settings, sensorConfig, rTSSService));
Add(new ATI.ATIGroup(settings, sensorConfig, processService));
Add(new Nvidia.NvidiaGroup(settings, sensorConfig, processService));
}

if (fanControllerEnabled)
Expand Down Expand Up @@ -166,7 +165,7 @@ public bool RAMEnabled
if (open && value != ramEnabled)
{
if (value)
Add(new RAM.RAMGroup(settings, sensorConfig, rTSSService));
Add(new RAM.RAMGroup(settings, sensorConfig, processService));
else
RemoveType<RAM.RAMGroup>();
}
Expand All @@ -185,8 +184,8 @@ public bool GPUEnabled
{
if (value)
{
Add(new ATI.ATIGroup(settings, sensorConfig, rTSSService));
Add(new Nvidia.NvidiaGroup(settings, sensorConfig, rTSSService));
Add(new ATI.ATIGroup(settings, sensorConfig, processService));
Add(new Nvidia.NvidiaGroup(settings, sensorConfig, processService));
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions source/OpenHardwareMonitor/Hardware/GPUBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CapFrameX.Contracts.RTSS;
using CapFrameX.Contracts.Sensor;
using Serilog;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -57,7 +58,7 @@ internal abstract class GPUBase : Hardware
protected float refreshRateCurrentWindowHandle;
protected RefreshRateBuffer<float> refreshRateBuffer;

public GPUBase(string name, Identifier identifier, ISettings settings, IRTSSService rTSSService) : base(name, identifier, settings)
public GPUBase(string name, Identifier identifier, ISettings settings, IProcessService processService) : base(name, identifier, settings)
{
refreshRateBuffer = new RefreshRateBuffer<float>(2);

Expand Down Expand Up @@ -111,7 +112,7 @@ public GPUBase(string name, Identifier identifier, ISettings settings, IRTSSServ
{
var category = new PerformanceCounterCategory("GPU Process Memory");

_ = rTSSService
_ = processService
.ProcessIdStream
.DistinctUntilChanged()
.Subscribe(id =>
Expand Down
16 changes: 8 additions & 8 deletions source/OpenHardwareMonitor/Hardware/IGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ This Source Code Form is subject to the terms of the Mozilla Public
*/

namespace OpenHardwareMonitor.Hardware {
namespace OpenHardwareMonitor.Hardware
{
internal interface IGroup
{

internal interface IGroup {
IHardware[] Hardware { get; }

IHardware[] Hardware { get; }

string GetReport();

void Close();
}
string GetReport();

void Close();
}
}
4 changes: 2 additions & 2 deletions source/OpenHardwareMonitor/Hardware/Nvidia/NvidiaGPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ internal class NvidiaGPU : GPUBase
private readonly Sensor voltageLimit;

public NvidiaGPU(int adapterIndex, NvPhysicalGpuHandle handle,
NvDisplayHandle? displayHandle, ISettings settings, ISensorConfig config, IRTSSService rTSSService)
NvDisplayHandle? displayHandle, ISettings settings, ISensorConfig config, IProcessService processService)
: base(GetName(handle), new Identifier("nvidiagpu",
adapterIndex.ToString(CultureInfo.InvariantCulture)), settings, rTSSService)
adapterIndex.ToString(CultureInfo.InvariantCulture)), settings, processService)
{
this.adapterIndex = adapterIndex;
this.handle = handle;
Expand Down
4 changes: 2 additions & 2 deletions source/OpenHardwareMonitor/Hardware/Nvidia/NvidiaGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal class NvidiaGroup : IGroup
private readonly List<Hardware> hardware = new List<Hardware>();
private readonly StringBuilder report = new StringBuilder();

public NvidiaGroup(ISettings settings, ISensorConfig sensorConfig, IRTSSService rTSSService)
public NvidiaGroup(ISettings settings, ISensorConfig sensorConfig, IProcessService processService)
{
if (!NVAPI.IsAvailable)
return;
Expand Down Expand Up @@ -101,7 +101,7 @@ public NvidiaGroup(ISettings settings, ISensorConfig sensorConfig, IRTSSService
for (int i = 0; i < count; i++)
{
displayHandles.TryGetValue(handles[i], out NvDisplayHandle displayHandle);
hardware.Add(new NvidiaGPU(i, handles[i], displayHandle, settings, sensorConfig, rTSSService));
hardware.Add(new NvidiaGPU(i, handles[i], displayHandle, settings, sensorConfig, processService));
}

report.AppendLine();
Expand Down
4 changes: 2 additions & 2 deletions source/OpenHardwareMonitor/Hardware/RAM/GenericRAM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal class GenericRAM : Hardware
private PerformanceCounter ramUsageGamePerformanceCounter;
private PerformanceCounter ramAndCacheUsageGamePerformanceCounter;

public GenericRAM(string name, ISettings settings, ISensorConfig config, IRTSSService service)
public GenericRAM(string name, ISettings settings, ISensorConfig config, IProcessService processService)
: base(name, new Identifier("ram"), settings)
{
sensorConfig = config;
Expand All @@ -43,7 +43,7 @@ public GenericRAM(string name, ISettings settings, ISensorConfig config, IRTSSSe
{
if (PerformanceCounterCategory.Exists("Process"))
{
service
processService
.ProcessIdStream
.DistinctUntilChanged()
.Subscribe(id =>
Expand Down
5 changes: 2 additions & 3 deletions source/OpenHardwareMonitor/Hardware/RAM/RAMGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ This Source Code Form is subject to the terms of the Mozilla Public
*/

using CapFrameX.Contracts.RTSS;
using CapFrameX.Contracts.Sensor;
using System;

Expand All @@ -18,7 +17,7 @@ internal class RAMGroup : IGroup
{
private Hardware[] hardware;

public RAMGroup(ISettings settings, ISensorConfig sensorConfig, IRTSSService rTSSService)
public RAMGroup(ISettings settings, ISensorConfig sensorConfig, IProcessService processService)
{
// No implementation for RAM on Unix systems
int p = (int)Environment.OSVersion.Platform;
Expand All @@ -28,7 +27,7 @@ public RAMGroup(ISettings settings, ISensorConfig sensorConfig, IRTSSService rTS
return;
}

hardware = new Hardware[] { new GenericRAM("Generic Memory", settings, sensorConfig, rTSSService) };
hardware = new Hardware[] { new GenericRAM("Generic Memory", settings, sensorConfig, processService) };
}

public string GetReport()
Expand Down

0 comments on commit b81f6de

Please sign in to comment.