CPU and RAM usage

By afp_romania on Sep 19, 2013

This code will display the CPU and RAM usage using two progressbars.
You will need:

  • 2 labels
  • 2 progressbars
  • 1 timer
  • 2 performance counters

Configuration
click performancecounter 1: categoryname - processor & countername - processortime
click performancecounter 2: categoryname - memory & countername - commited by bytes
Press F5 to start debugging.
Image for my application: http://romaniachat.ro/images/slider/slider2.jpg

Public Class Form1
      Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Timer1.Enabled = True

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        ProgressBar1.Value = PerformanceCounter1.NextValue
        ProgressBar2.Value = PerformanceCounter2.NextValue
    End Sub
End Class

Comments

Sign in to comment.
afp_romania   -  Sep 19, 2013

I forgot to mention: click on timer and on Properties set:

  • Interval: 500
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.