You need to get the list of processes running on your 4D server, 4D remote or 4D standalone to create your own Administration Window? You want to know which user initiated each process to create a monitoring window of your application or log this information in a database to analyze later your server load? It is now easy to retrieve this information by programming with a new command: Get process activity.
Monitoring of processes and users
Get process activity is a new 4D command that allows you to retrieve the list of running processes and connected users.
Thanks to this command, you can monitor the server activity from processes and user point of view and easily create this type of process viewer, as provided in our database example:
Please also note that this feature is a first step to provide you all tools to create your own customized server administration window. Processes and users is a beginning, of course more possibilities will arrive with future R-releases.
Code Examples
The Get process activity command includes two selectors (Processes only and Sessions only) to give the option to the developer to retrieve either the information about the processes only or the information related to users (sessions) only. When no parameter is passed, it returns an object containing 2 collections: processes and sessions.
C_OBJECT($activity)
$activity:=Get process activity // processes + sessions at once
C_COLLECTION($pCol;$sCol)
$pCol:=$activity.processes
$sCol:=$activity.sessions
Example of information returned in the processes collection:
{ name:Application process, sessionID:4E3F3701DA6E4C449513D11FB68AA01C, number:4, ID:4, visible:true, type:-18, state:2, cpuUsage:0.022585061256626, cpuTime:8.1486859585647, preemptive:false }, { name:DB4D Flush, state:0, cpuUsage:0, cpuTime:0, preemptive:true }, (...)
Example of information returned in the sessions collection:
{ type:remote, userName:Designer, machineName:VM10-MAINGUENE, systemUserName:fmainguene, IPAddress:localhost, creationDateTime:2017-04-26T07:59:27Z, state:active, ID:4E3F3701DA6E4C449513D11FB68AA01C }