CPU Usage?
-
Actually I want to display the Amount of Available Memory and CPU Usage and also its history on Screen just like one on Task Manager. So far I am able to display the Available Memory on Screen by using a Performance Counter under Memory Category "Available KBytes". But how can i display the CPU Usage and its History. I am using the "% Processor Time" Performance counter but can't see anything happening on screen. What should i use for this purpose. Thanks for your cooperation ! AliAmjad(MCP)
-
Actually I want to display the Amount of Available Memory and CPU Usage and also its history on Screen just like one on Task Manager. So far I am able to display the Available Memory on Screen by using a Performance Counter under Memory Category "Available KBytes". But how can i display the CPU Usage and its History. I am using the "% Processor Time" Performance counter but can't see anything happening on screen. What should i use for this purpose. Thanks for your cooperation ! AliAmjad(MCP)
Would you care to show the code that you are using for the PerformanceCounter class? It sounds like it ought to be working. I've done this numerous times in the past and it works.
"Find it your bloody self - immediately!" - Dave Kreskowiak
-
Would you care to show the code that you are using for the PerformanceCounter class? It sounds like it ought to be working. I've done this numerous times in the past and it works.
"Find it your bloody self - immediately!" - Dave Kreskowiak
I am using the
RawValue
Property of "Available KBytes" Performance Counter and also used the same one for "% Processor Time" under a Timer which updates the Text of the Label after every Second But I Get always a '0' for "% Processor Time" is there any other way of using this counter and also what about the real time graph how can i display it on screen. AliAmjad (MCP) -
I am using the
RawValue
Property of "Available KBytes" Performance Counter and also used the same one for "% Processor Time" under a Timer which updates the Text of the Label after every Second But I Get always a '0' for "% Processor Time" is there any other way of using this counter and also what about the real time graph how can i display it on screen. AliAmjad (MCP)Do you get values when you try the performance counter properties through the actual performance counter tool in the Admin Tools?
"Find it your bloody self - immediately!" - Dave Kreskowiak
-
Do you get values when you try the performance counter properties through the actual performance counter tool in the Admin Tools?
"Find it your bloody self - immediately!" - Dave Kreskowiak
Paul Conrad wrote:
Do you get values when you try the performance counter properties through the actual performance counter tool in the Admin Tools?
Yes i am getting values. But not on the form. I have actually created a new category and then created a copy of "% Processor Time" performance counter in it. What else should i do? AliAmjad (MCP)
-
Paul Conrad wrote:
Do you get values when you try the performance counter properties through the actual performance counter tool in the Admin Tools?
Yes i am getting values. But not on the form. I have actually created a new category and then created a copy of "% Processor Time" performance counter in it. What else should i do? AliAmjad (MCP)
Ok I've found the Solution for this Problem I am using the following Code now:
Dim CPULoadCounter As New PerformanceCounter Private Sub tmrUsage\_Tick(ByVal sender As System.Object, ByVal e As system.EventArgs) Handles tmrUsage.Tick Dim lCPULoadCounterNextValue As Single = CPULoadCounter.NextValue() Me.lblCPULoad.Text = CType(lCPULoadCounterNextValue, Integer) & "%" End Sub Private Sub CPULoadCounterInitializer() CPULoadCounter.CategoryName = "Processor" CPULoadCounter.CounterName = "% Processor Time" CPULoadCounter.InstanceName = "\_Total" End Sub
Can you please tell me how can i get the Total Physical RAM Size in VB.NET? AliAmjad (MCP)
-
Ok I've found the Solution for this Problem I am using the following Code now:
Dim CPULoadCounter As New PerformanceCounter Private Sub tmrUsage\_Tick(ByVal sender As System.Object, ByVal e As system.EventArgs) Handles tmrUsage.Tick Dim lCPULoadCounterNextValue As Single = CPULoadCounter.NextValue() Me.lblCPULoad.Text = CType(lCPULoadCounterNextValue, Integer) & "%" End Sub Private Sub CPULoadCounterInitializer() CPULoadCounter.CategoryName = "Processor" CPULoadCounter.CounterName = "% Processor Time" CPULoadCounter.InstanceName = "\_Total" End Sub
Can you please tell me how can i get the Total Physical RAM Size in VB.NET? AliAmjad (MCP)