cpu performance with wmi ...
-
how can i get usage cpu performance from wmi based on c# ? many solution just write about sql script or the other.
-
how can i get usage cpu performance from wmi based on c# ? many solution just write about sql script or the other.
when i use PerformanceCounter, it can get a information cpu performance. but it just cpu own. i.e, case of invoke progressbar, it can display cpu usage rate. it just one thread. but i wanna get a cpu,network and memory usage rate. so i make them in one thread. but always cpu usage rate 0% in my project. i don't understand it. following my code. ------------------------ PerformanceCounter p = new PerformanceCounter(); p.CategoryName = "Processor"; p.CounterName = "% Processor Time"; p.InstanceName = "_Total"; ... progressbar invoke ... float usage = p.NextValue(); progressBar1.Value = ((int)usage); label1.Text = "CPU usage : " + ((int)usage).ToString() + "%"; ..... it can display useage rate... i write this code in my project, but case on my project. it can't display performance. :(
-
how can i get usage cpu performance from wmi based on c# ? many solution just write about sql script or the other.
Hello, Have you tried this:
ManagementObject processor = new ManagementObject("Win32\_PerfFormattedData\_PerfOS\_Processor.Name='\_Total'"); processor.Get(); ulong value = (ulong)processor.Properties\["PercentProcessorTime"\].Value;
Valery.