Platforms to show: All Mac Windows Linux Cross-Platform
/MacCF/Darwin Host VM Statistics
Required plugins for this example: MBS MacCF Plugin
Last modified Thu, 3rd Jul 2024.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /MacCF/Darwin Host VM Statistics
Download this example: Darwin Host VM Statistics.zip
Project "Darwin Host VM Statistics.xojo_binary_project"
Class App Inherits DesktopApplication
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits DesktopWindow
Control List Inherits DesktopListBox
ControlInstance List Inherits DesktopListBox
EventHandler Sub Opening()
Me.ColumnAlignmentAt(1) = DesktopListBox.Alignments.Right
Me.ColumnAlignmentAt(2) = DesktopListBox.Alignments.Right
RowForKey = New Dictionary
End EventHandler
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
update
End EventHandler
End Control
Sub AddValue(key as string, pages as integer, description as string)
Var bytes As Integer = pages * pageSize
Var megabytes As Double = bytes / 1024 / 1024
Var row As Integer = RowForKey.Lookup(key, -1)
If row >= 0 And List.RowTagAt(row) = key Then
// found it
else
// list changed?
Var u As Integer = List.LastRowIndex
For i As Integer = 0 To u
If List.RowTagAt(i) = key Then
row = i
Exit
end if
Next
End If
If row < 0 Then
List.AddRow key, pages.ToString, megabytes.ToString("0.0")+" MB", description
List.RowTagAt(List.LastAddedRowIndex) = key
RowForKey.Value(key) = List.LastAddedRowIndex
End If
End Sub
Sub update()
Var d As New DarwinHostVMStatisticsMBS
pageSize = d.Pagesize
AddValue "FreeCount", d.FreeCount, "# of pages free"
AddValue "ActiveCount", d.ActiveCount, "# of pages active"
AddValue "InactiveCount", d.InactiveCount, "# of pages inactive"
AddValue "WireCount", d.WireCount, "# of pages wired down"
AddValue "ZeroFillCount", d.ZeroFillCount, "# of zero fill pages"
AddValue "Reactivations", d.Reactivations, "# of pages reactivated"
AddValue "Pageins", d.Pageins, "# of pageins"
AddValue "Pageouts", d.Pageouts, "# of pageouts"
AddValue "Faults", d.Faults, "# of faults"
AddValue "CopyOnWriteFaults", d.CopyOnWriteFaults, "# of copy-on-writes"
AddValue "Lookups", d.Lookups, "object cache lookups"
AddValue "Hits", d.Hits, "object cache hits"
AddValue "Purges", d.Purges, "# of pages purged"
AddValue "PurgeableCount", d.PurgeableCount, "# of pages purgeable"
AddValue "SpeculativeCount", d.SpeculativeCount, "# of pages speculative"
AddValue "Decompressions", d.Decompressions, "# of pages decompressed"
AddValue "Compressions", d.Compressions, "# of pages compressed"
AddValue "Swapins", d.Swapins, "# of pages swapped in (via compression segments)"
AddValue "Swapouts", d.Swapouts, "# of pages swapped out (via compression segments)"
AddValue "CompressorPageCount", d.CompressorPageCount, "# of pages used by the compressed pager to hold all the compressed data"
AddValue "ThrottledCount", d.ThrottledCount, "# of pages throttled"
AddValue "ExternalPageCount", d.ExternalPageCount, "# of pages that are file-backed (non-swap)"
End Sub
Property RowForKey As Dictionary
Property pageSize As Integer
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
MenuItem HelpMenu = "&Help"
End MenuBar
Sign
End Sign
End Project
See also:
- /MacCF/Darwin Chmod test
- /MacCF/Darwin Drive Statistics
- /MacCF/Darwin Memory Statistics
- /MacCF/Darwin Network Interface Statistics
- /MacCF/Darwin Resource Usage
- /MacCF/Darwin VM Statistics
Download this example: Darwin Host VM Statistics.zip
The items on this page are in the following plugins: MBS MacCF Plugin.