Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » Utilities » Downloads
 
Add your own
alternative version

Application dashboard for tracking .NET application performance

, 26 Jul 2006
Provides graphical feedback on the performance (memory usage, garbage collection, threads, exceptions, loaded classes) of a .NET application.
Imports System.Windows.Forms
Imports System.Diagnostics

Public Class SettingsForm

    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add all the running instances of .NET apps to the drop down list
        If PerformanceCounterCategory.CounterExists("# GC Handles", Form_Dashboard.COUNTER_CATEGORY_MEMORY) Then
            Dim pcInst As New PerformanceCounterCategory(Form_Dashboard.COUNTER_CATEGORY_MEMORY)
            With pcInst
                Dim Items() As String = .GetInstanceNames
                For Each f As String In Items
                    Me.ComboBox_ApplicationInstances.Items.Add(f)
                Next
            End With
        End If

        Try
            If My.Settings.MonitoredInstanceName <> "" Then
                Me.ComboBox_ApplicationInstances.SelectedItem = My.Settings.MonitoredInstanceName
            End If
        Catch ex As Exception
            Debug.Fail(ex.ToString)
        End Try

        With My.Settings
            Me.TextBox_Max_Classes.Text = .DialClassesMaximum.ToString
            Me.TextBox_Max_Exceptions.Text = .DialExceptionsMaximum.ToString
            Me.TextBox_Max_Garbage.Text = .DialGarbageMaximum.ToString
            Me.TextBox_Max_Memory.Text = .DialMemoryMaximum.ToString
            Me.TextBox_Max_Threads.Text = .DialThreadsMaximum.ToString
            Me.TextBox_Min_Classes.Text = .DialClassesMinimum.ToString
            Me.TextBox_Min_Exceptions.Text = .DialExceptionsMinimum.ToString
            Me.TextBox_Min_Garbage.Text = .DialGarbageMinimum.ToString
            Me.TextBox_Min_Memory.Text = .DialMemoryMinimum.ToString
            Me.TextBox_Min_Threads.Text = .DialThreadsMinimum.ToString
        End With

    End Sub

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Public ReadOnly Property SelectedInstanceName() As String
        Get
            Return Me.ComboBox_ApplicationInstances.Text
        End Get
    End Property

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Duncan Edwards Jones
Software Developer (Senior)
Ireland Ireland
C# / SQL Server developer
Microsoft MVP 2006, 2007
Visual Basic .NET
Follow on   Twitter   LinkedIn

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 27 Jul 2006
Article Copyright 2006 by Duncan Edwards Jones
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid