Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCF/CPU load info
Function:
Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/CPU load info
This example is the version from Sun, 17th Mar 2012.
Project "CPU load info.rbp"
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control uTicks Inherits Label
ControlInstance uTicks Inherits Label
End Control
Control sTicks Inherits Label
ControlInstance sTicks Inherits Label
End Control
Control iTicks Inherits Label
ControlInstance iTicks Inherits Label
End Control
Control nTicks Inherits Label
ControlInstance nTicks Inherits Label
End Control
Control uPercent Inherits Label
ControlInstance uPercent Inherits Label
End Control
Control sPercent Inherits Label
ControlInstance sPercent Inherits Label
End Control
Control iPercent Inherits Label
ControlInstance iPercent Inherits Label
End Control
Control nPercent Inherits Label
ControlInstance nPercent Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() update End EventHandler
End Control
EventHandler Function MouseDown(X As Integer, Y As Integer) As Boolean MsgBox str(last.CPUTicksIdle) End EventHandler
EventHandler Sub Open() update End EventHandler
Sub update() dim totalticks,systicks, idleticks, niceticks, userticks as integer dim d as DarwinVMStatisticsMBS if last=nil then last=GetDarwinVMStatisticsMBS else d=GetDarwinVMStatisticsMBS systicks=abs(d.CPUTicksSystem-last.CPUTicksSystem) userticks=abs(d.CPUTicksUser-last.CPUTicksUser) idleticks=abs(d.CPUTicksIdle-last.CPUTicksIdle) niceticks=abs(d.CPUTicksNice-last.CPUTicksNice) totalticks=userticks+idleticks+niceticks+systicks sTicks.text=format(systicks,"0") uTicks.text=format(userticks,"0") iTicks.text=format(idleticks,"0") nTicks.text=format(niceticks,"0") sPercent.text=format(systicks/totalticks,"0%") uPercent.text=format(userticks/totalticks,"0%") nPercent.text=format(niceticks/totalticks,"0%") iPercent.text=format(idleticks/totalticks,"0%") last=d end if End Sub
Property Protected last As darwinVMStatisticsMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCF Plugin.




Links
MBS Xojo Plugins