
proc ShowRessources {} {
    global WDRessources DefPadX

    set title "System Ressources"

    if {[RegisterFormOrWindow $title ressources WDRessources ShowRessources \
            "Done"          {} \
            ""              {} \
            ""              {} \
            ""              {} \
        ]
    } {
        UpdateRessources
        return
    }


    frame $WDRessources.frame1

    pack $WDRessources.frame1 \
        -side top -fill x -padx $DefPadX -pady 5m

    label $WDRessources.frame1.label -text "Memory Management:" -anchor w

    label $WDRessources.frame1.heapsize \
        -text "  Current Heap Size: [goblin size]" -anchor w
    label $WDRessources.frame1.maxsize \
        -text "  Maximum Heap Size: [goblin maxsize]" -anchor w
    label $WDRessources.frame1.objects \
        -text "  Current Number of Objects: [goblin #objects]" -anchor w
    label $WDRessources.frame1.fragments \
        -text "  Current Number of Fragments: [goblin #fragments]" -anchor w
    label $WDRessources.frame1.allocs \
        -text "  Total Number of Allocations: [goblin #allocs]" -anchor w

    pack $WDRessources.frame1.label $WDRessources.frame1.heapsize \
        $WDRessources.frame1.maxsize $WDRessources.frame1.objects \
        $WDRessources.frame1.fragments $WDRessources.frame1.allocs -fill x

        
    UpdateRessources

    DisplayForm $title
}


proc UpdateRessources {} {
    global WDRessources

    $WDRessources.frame1.heapsize configure \
        -text "  Current Heap Size: [goblin size]" -anchor w
    $WDRessources.frame1.maxsize configure \
        -text "  Maximum Heap Size: [goblin maxsize]" -anchor w
    $WDRessources.frame1.objects configure \
        -text "  Current Number of Objects: [goblin #objects]" -anchor w
    $WDRessources.frame1.fragments configure \
        -text "  Current Number of Fragments: [goblin #fragments]" -anchor w
    $WDRessources.frame1.allocs configure \
        -text "  Total Number of Allocations: [goblin #allocs]" -anchor w

    AlignActiveDialog
}

ShowRessources
