using System;
using System.Diagnostics;
namespace IgniteEngine
{
///
/// Records application profiling information.
///
public class Profiler
{
///
/// Returns the current application CPU Usage.
///
public static double CPUUsage => Math.Ceiling(cpuCounter.NextValue());
///
/// Returns the current application RAM Usage.
///
public static double RAMUsage => Math.Ceiling(ramCounter.NextValue() / 1024 / 1024);
///
/// Records application CPU usage.
///
private static readonly PerformanceCounter cpuCounter = new PerformanceCounter("Process", "% Processor Time", Process.GetCurrentProcess().ProcessName);
///
/// Records application RAM usage.
///
private static readonly PerformanceCounter ramCounter = new PerformanceCounter("Process", "Working Set", Process.GetCurrentProcess().ProcessName);
}
}