Skip to content

Commit

Permalink
Update SystemInfoHelper.Windows.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
laolarou726 committed Nov 12, 2023
1 parent 863e444 commit c01469c
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class SystemInfoHelper
{
static readonly PerformanceCounter FreeMemCounter = new("Memory", "Available MBytes");
static readonly PerformanceCounter MemUsagePercentageCounter = new("Memory", "% Committed Bytes In Use");
static readonly PerformanceCounter CpuCounter = new("Processor", "% Processor Time", "_Total");
static readonly PerformanceCounter CpuCounter = new("Processor Information", "% Processor Utility", "_Total");

static SystemInfoHelper()
{
Expand Down Expand Up @@ -125,8 +125,12 @@ static AppxPackageInfo SetAppxPackageInfoProperty(AppxPackageInfo appxPackageInf
"NonRemovable" => appxPackageInfo with { NonRemovable = Convert.ToBoolean(value) },
"Dependencies" => appxPackageInfo with
{
Dependencies = value.TrimStart('{').TrimEnd('}').Split(',')
.Select(s => s.Trim()).ToArray()
Dependencies = value
.TrimStart('{')
.TrimEnd('}')
.Split(',')
.Select(s => s.Trim())
.ToArray()
},
"IsPartiallyStaged" => appxPackageInfo with { IsPartiallyStaged = Convert.ToBoolean(value) },
"SignatureKind" => appxPackageInfo with { SignatureKind = value },
Expand Down Expand Up @@ -226,7 +230,7 @@ public static MemoryInfo GetWindowsMemoryStatus()
/// <returns></returns>
public static CPUInfo GetWindowsCpuUsage()
{
var percentage = CpuCounter.NextValue();
var percentage = CpuCounter.NextValue() / Environment.ProcessorCount * 100;

return new CPUInfo
{
Expand Down

0 comments on commit c01469c

Please sign in to comment.