Estoy haciendo un medido de CPU y RAM con arduino para que lo escriba en un LCD.
El problema es que cuando quiero medir la RAM con performance counter me da mas bajo que el administrador de tareas y open hardware monitor
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//using Microsoft.VisualBasic.Devices;
namespace Performance_Counter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
String COMPort = "COM5";
private void Form1_Load(object sender, EventArgs e)
{
try
{
serialPort1.PortName = COMPort;
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.StopBits = (StopBits)Enum.Parse(typeof(StopBits), "One");
serialPort1.Parity = (Parity)Enum.Parse(typeof(Parity), "None");
serialPort1.Open();
progressBar1.Value = 100;
}
catch (Exception err)
{
MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
lblCOMPort.Text = COMPort;
}
private void timer1_Tick(object sender, EventArgs e)
{
string CPUUsage = "CPU:" + performanceCounterCPU.NextValue();
string RAMUsage = "RAM:" + performanceCounterRAM.NextValue();
if (serialPort1.IsOpen)
{
serialPort1.WriteLine(CPUUsage + " ");
serialPort1.WriteLine(RAMUsage + " ");
}
}
}
}
performanceCounterCPU
CategoryName: Procesador
CounterName: % de tiempo de procesador
InstanceName: _Total
performanceCounterRAM
CategoryName: Memory
CounterName: % Committed Bytes in use
InstanceName: