using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace Azylee.Core.AppUtils
{
public class AppInfoTool
{
///
/// 读取APP Processor(可读取App的CPU使用率)
///
///
public static PerformanceCounter Processor()
{
Process p = null;
PerformanceCounter processor = null;
try
{
p = Process.GetCurrentProcess();
processor = new PerformanceCounter("Process", "% Processor Time", p.ProcessName);
}
catch { }
return processor;
}
///
/// 读取APP占用内存(单位:KB)
///
///
public static long RAM()
{
long value = 0;
Process p = null;
try
{
p = Process.GetCurrentProcess();
value = p.WorkingSet64 / 1024;
}
catch { }
finally { p?.Dispose(); }
return value;
}
}
}