Skip to main content

%SYS.ProcessQuery

persistent class %SYS.ProcessQuery extends %Library.Persistent, %SYSTEM.Help

SQL Table Name: %SYS.ProcessQuery

This class allows manipulation and display of Cache processes running on the system.
An instance of the class can be opened by passing the PID (O/S process id) to the %OpenId Method. The PID is in decimal form ($J) for all platforms.

NOTE: Previous versions of this class allowed you to call the %OpenId method and pass in either a PID preceded by the letter "P", or a job number preceded by the letter "J". This functionality has been removed from the %OpenId() method, and moved to the new Open() method which supports this syntax.

For example, the following open a process with a PID of 2078:

s Process=##CLASS(%SYS.ProcessQuery).%OpenId("2078")
s Process=##CLASS(%SYS.ProcessQuery).Open("P2078")
s Process=##CLASS(%SYS.ProcessQuery).Open("2078")

The following will open Job number 23

s Process=##CLASS(%SYS.ProcessQuery).Open("J23")

Performance considerations:
When you use %OpenId() to examine a process, several mailbox messages will get sent to the process to return ALL of the properties for the object. On systems with lots of processes running, and you are collecting data for a lot of processes, this can cause a lot of overhead. The call to each %OpenId() in this case may actually take several seconds to complete. Most of a processes properties can be retrieved without the overhead of a mailbox message. See the description of the individual properties below for which properties require a mailbox message to be sent.
If you want to minimize overhead, you should use an SQL statement to select ONLY the data which you want returned. For example, here is some code which loops through all the processes on the system, and retrieves specific data for each process. Note that the properties which are returned in this example are ones which do not require a mailbox messages to be sent to the process being examined. Note that the %syPidtab.inc file needs to be included in your routine in order for the following code to compile cleanly.

#include %syPidtab
Set Rset = ##class(%ResultSet).%New("%SYS.ProcessQuery:ListPids")
d Rset.Execute()
While Rset.Next() {
&sql(SELECT CommandsExecuted,GlobalReferences INTO :CommandsExecuted,:GlobalReferences
FROM %SYS.ProcessQuery
WHERE Pid = :Rset.GetData(1))
i SQLCODE'=0 w !,"SQL Error "_SQLCODE continue ; 100 means process does not exist (halted)
w !,Rset.GetData(1)," ",CommandsExecuted," ",GlobalReferences
}
d Rset.Close()

Security considerations:
Any process can open an instance to their own process by passing the value of $J to the %OpenId() method:

s Process=##CLASS(%SYS.ProcessQuery).%OpenId($j)

If you wish to open another process, you must own the %Admin_Manage:Use resource, or have read or write access to the CACHESYS database. To minimize overhead in the %OpenId() method, having the %Admin_Manage:Use privilege is recommended.
This class has an SQL table called %SYS.ProcessQuery where you can execute an SQL query to return process data. For example you could execute the following queries:

Select * from %SYS.ProcessQuery - Return all information about all processes
Select * from %SYS.ProcessQuery where NameSpace = 'User" - Return all information about all processes in the USER namespace.
Note that in order to run this from an unprivileged user, you may need to grant privileges to that user on the table as follows:

GRANT SELECT ON %SYS.ProcessQuery TO _PUBLIC

Notes:
Replace _PUBLIC to a specific user or role name if you don't want everyone to have the privilege.
This is per-namespace. This needs to be executed in each namespace the table needs to be queried from.

Property Inventory

Method Inventory

Parameters

parameter DEFAULTCONCURRENCY = 0;
Inherited description: DEFAULTCONCURRENCY is the default value for the concurrency formal argument defined for %Open, %OpenId, %Delete and %DeleteId methods. It is not the default value of the %Concurrency property of persistent classes. If the value of the actual concurrency argument passed to any of the above methods is -1 then the formal argument value will be set to the value of the DEFAULTCONCURRENCY parameter value defined for the class.
parameter DOMAIN = %Utility;
Set this to the correct domain.

Properties

property CSPSessionID as %String [ ReadOnly ];
CSP Session ID of client connected to process.
CSP session ID of the client which initiated the connection. It is passed down to the process as part of the initial connection message, and used to manager the CSP session.
Property methods: CSPSessionIDDisplayToLogical(), CSPSessionIDGet(), CSPSessionIDIsValid(), CSPSessionIDLogicalToDisplay(), CSPSessionIDLogicalToOdbc(), CSPSessionIDNormalize()
property CanBeExamined as %Boolean [ ReadOnly ];
Process can be examined.
Flag checked by JOBEXAM and Mgt Portal to see if a process can be examined in detail.
Property methods: CanBeExaminedDisplayToLogical(), CanBeExaminedGet(), CanBeExaminedIsValid(), CanBeExaminedLogicalToDisplay(), CanBeExaminedNormalize()
property CanBeSuspended as %Boolean [ ReadOnly ];
Process can be suspended.
Flag checked by JOBEXAM and Mgt Portal to see if a process can be suspended.
Property methods: CanBeSuspendedDisplayToLogical(), CanBeSuspendedGet(), CanBeSuspendedIsValid(), CanBeSuspendedLogicalToDisplay(), CanBeSuspendedNormalize()
property CanBeTerminated as %Boolean [ ReadOnly ];
Process can be terminated.
Flag checked by JOBEXAM and Mgt Portal to see if a process can be terminated.
Property methods: CanBeTerminatedDisplayToLogical(), CanBeTerminatedGet(), CanBeTerminatedIsValid(), CanBeTerminatedLogicalToDisplay(), CanBeTerminatedNormalize()
property CanReceiveBroadcast as %Boolean [ ReadOnly ];
Process can receive broadcast.
Flag checked by JOBEXAM and Mgt Portal to see if a process can receive a broadcast. Usually this means they are attached to a terminal.
Property methods: CanReceiveBroadcastDisplayToLogical(), CanReceiveBroadcastGet(), CanReceiveBroadcastIsValid(), CanReceiveBroadcastLogicalToDisplay(), CanReceiveBroadcastNormalize()
property ClientExecutableName as %String;
Executable name of the process on the client.
The name of the Executable or DLL on the client which initiated the connection. It is passed down to the process as part of the initial connection message. This property may be set by the end-user if they are managing their own connections.
Property methods: ClientExecutableNameDisplayToLogical(), ClientExecutableNameGet(), ClientExecutableNameIsValid(), ClientExecutableNameLogicalToDisplay(), ClientExecutableNameLogicalToOdbc(), ClientExecutableNameNormalize()
property ClientIPAddress as %String;
IP Address of client connected to the process.
IP address of the client which initiated the connection. It is passed down to the process as part of the initial connection message. This property may be set by the end-user if they are managing their own connections.
Property methods: ClientIPAddressDisplayToLogical(), ClientIPAddressGet(), ClientIPAddressIsValid(), ClientIPAddressLogicalToDisplay(), ClientIPAddressLogicalToOdbc(), ClientIPAddressNormalize()
property ClientNodeName as %String;
Node Name of the client connected to the process.
Node name of the client which initiated the connection. It is passed down to the process as part of the initial connection message. This property may be set by the end-user if they are managing their own connections.
Property methods: ClientNodeNameDisplayToLogical(), ClientNodeNameGet(), ClientNodeNameIsValid(), ClientNodeNameLogicalToDisplay(), ClientNodeNameLogicalToOdbc(), ClientNodeNameNormalize()
property CommandsExecuted as %BigInt [ ReadOnly ];
Number of Commands Executed.
Total number of commands which the process has executed.
Property methods: CommandsExecutedDisplayToLogical(), CommandsExecutedGet(), CommandsExecutedIsValid(), CommandsExecutedLogicalToDisplay(), CommandsExecutedNormalize()
property CurrentDevice as %String [ ReadOnly ];
Current Device ($i).
Current device that the process has open and is USEing via the USE command.
Property methods: CurrentDeviceDisplayToLogical(), CurrentDeviceGet(), CurrentDeviceIsValid(), CurrentDeviceLogicalToDisplay(), CurrentDeviceLogicalToOdbc(), CurrentDeviceNormalize()
property CurrentLineAndRoutine as %String [ ReadOnly ];
Current Line and Routine.
Current line and routine that the process is executing. Returned in +number^routine format.
This property requires a mailbox message to be sent to the process being examined.
Property methods: CurrentLineAndRoutineDisplayToLogical(), CurrentLineAndRoutineGet(), CurrentLineAndRoutineIsValid(), CurrentLineAndRoutineLogicalToDisplay(), CurrentLineAndRoutineLogicalToOdbc(), CurrentLineAndRoutineNormalize()
property CurrentSrcLine as %String [ ReadOnly ];
Current Source Line being executed.
Current line of source code which is being executed by the process. If "", then the source code line is unavailable.
This property requires a mailbox message to be sent to the process being examined. If the routine has been modified compared to the pcode being run then this will point to the current routine source rather than the actual source of the code being executed.
Property methods: CurrentSrcLineDisplayToLogical(), CurrentSrcLineGet(), CurrentSrcLineIsValid(), CurrentSrcLineLogicalToDisplay(), CurrentSrcLineLogicalToOdbc(), CurrentSrcLineNormalize()
property DataBlockWrites as %Integer [ ReadOnly ];
Number of Data blocks marked for Write.
Property methods: DataBlockWritesDisplayToLogical(), DataBlockWritesGet(), DataBlockWritesIsValid(), DataBlockWritesLogicalToDisplay(), DataBlockWritesNormalize()
property EscalatedRoles as %String [ Calculated ];
Additional roles granted to the set of login roles.
Property methods: EscalatedRolesDisplayToLogical(), EscalatedRolesIsValid(), EscalatedRolesLogicalToDisplay(), EscalatedRolesLogicalToOdbc(), EscalatedRolesNormalize()
property GlobalBlocks as %Integer [ ReadOnly ];
Number of Database Block Allocations.
Total number of new database blocks the process has allocated. An indication of database growth.
Property methods: GlobalBlocksDisplayToLogical(), GlobalBlocksGet(), GlobalBlocksIsValid(), GlobalBlocksLogicalToDisplay(), GlobalBlocksNormalize()
property GlobalDiskReads as %Integer [ ReadOnly ];
Number of Physical Database Reads.
Total number of times the process has fetched data from disk.
Property methods: GlobalDiskReadsDisplayToLogical(), GlobalDiskReadsGet(), GlobalDiskReadsIsValid(), GlobalDiskReadsLogicalToDisplay(), GlobalDiskReadsNormalize()
property GlobalReferences as %BigInt [ ReadOnly ];
Number of Global References.
Total number of global references the process has made.
Property methods: GlobalReferencesDisplayToLogical(), GlobalReferencesGet(), GlobalReferencesIsValid(), GlobalReferencesLogicalToDisplay(), GlobalReferencesNormalize()
property GlobalUpdates as %Integer [ ReadOnly ];
Number of Global Updates.
Total number of global updates (sets and kills) the process has made.
Property methods: GlobalUpdatesDisplayToLogical(), GlobalUpdatesGet(), GlobalUpdatesIsValid(), GlobalUpdatesLogicalToDisplay(), GlobalUpdatesNormalize()
property InTransaction as %Integer [ ReadOnly ];
In a transaction.
If 0, the process is not in a transaction.
If >0, the process has executed a tstart command, is in a transaction, and the value is the offset in the journal file where the transaction has started.
Property methods: InTransactionDisplayToLogical(), InTransactionGet(), InTransactionIsValid(), InTransactionLogicalToDisplay(), InTransactionNormalize()
property IsGhost as %Boolean [ ReadOnly ];
Is a Ghost process.
The process has been killed at the O/S level, and has not yet been cleaned up by the CLNDMN process. Until the process is cleaned, their may be outstanding locks or resources which may be unavailable to other processes.
This property requires a mailbox message to be sent to the process being examined.
Property methods: IsGhostDisplayToLogical(), IsGhostGet(), IsGhostIsValid(), IsGhostLogicalToDisplay(), IsGhostNormalize()
property JobNumber as %Integer [ ReadOnly ];
Job number in process table.
Used as an index into the job table. May be passed to the Open() method to open an object instance to that process.
Property methods: JobNumberDisplayToLogical(), JobNumberGet(), JobNumberIsValid(), JobNumberLogicalToDisplay(), JobNumberNormalize()
property JobType as %Integer [ ReadOnly ];
Job type.
Number which tells what type of process it is.
See the %syPidtab.inc include file for a definition of macros for these fields. Only use the defined macros in %syPidtab when referencing these fields. For example:

If Process.JobType=$$$WDTYPE w !,"Process is the write daemon"
Property methods: JobTypeDisplayToLogical(), JobTypeGet(), JobTypeIsValid(), JobTypeLogicalToDisplay(), JobTypeNormalize()
property JournalEntries as %Integer [ ReadOnly ];
Number of Journal Entries.
Total number of journaled global updates the process has recorded. An indication of journal file growth.
Property methods: JournalEntriesDisplayToLogical(), JournalEntriesGet(), JournalEntriesIsValid(), JournalEntriesLogicalToDisplay(), JournalEntriesNormalize()
property LastGlobalReference as %String [ ReadOnly ];
Last Global Reference.
Last global reference that the process made.
This property requires a mailbox message to be sent to the process being examined.
Property methods: LastGlobalReferenceDisplayToLogical(), LastGlobalReferenceGet(), LastGlobalReferenceIsValid(), LastGlobalReferenceLogicalToDisplay(), LastGlobalReferenceLogicalToOdbc(), LastGlobalReferenceNormalize()
property LicenseUserId as %String [ ReadOnly ];
User Id used for license.
The User ID which took out the license for the process.
Property methods: LicenseUserIdDisplayToLogical(), LicenseUserIdGet(), LicenseUserIdIsValid(), LicenseUserIdLogicalToDisplay(), LicenseUserIdLogicalToOdbc(), LicenseUserIdNormalize()
property LinesExecuted as %BigInt [ ReadOnly ];
Number of Lines Executed.
Total number of lines which the process has executed. NOTE: This property is deprecated, line counts are no longer available and this actually returns the CommandsExecuted. It is left here for backwards compatibility, but should no longer be used.
Property methods: LinesExecutedDisplayToLogical(), LinesExecutedGet(), LinesExecutedIsValid(), LinesExecutedLogicalToDisplay(), LinesExecutedNormalize()
property Location as %String [ ReadOnly ];
Location.
If a system process, will be the system processes name.
If a user process, will be the value of $g(^%IS(0,Job.CurrentDevice),"")
Property methods: LocationDisplayToLogical(), LocationGet(), LocationIsValid(), LocationLogicalToDisplay(), LocationLogicalToOdbc(), LocationNormalize()
property LoginRoles as %String [ ReadOnly ];
Login roles.
Roles a process has when it initially logs in.
Property methods: LoginRolesDisplayToLogical(), LoginRolesGet(), LoginRolesIsValid(), LoginRolesLogicalToDisplay(), LoginRolesLogicalToOdbc(), LoginRolesNormalize()
property MemoryAllocated as %Integer [ ReadOnly ];
Maximum memory able to be used in KB ($ZS).
Maximum amount of memory in KB that the process is allowed to use.
This property requires a mailbox message to be sent to the process being examined.
Property methods: MemoryAllocatedDisplayToLogical(), MemoryAllocatedGet(), MemoryAllocatedIsValid(), MemoryAllocatedLogicalToDisplay(), MemoryAllocatedNormalize()
property MemoryPeak as %Integer [ ReadOnly ];
Peak memory allocated in KB.
This property requires a mailbox message to be sent to the process being examined.
Property methods: MemoryPeakDisplayToLogical(), MemoryPeakGet(), MemoryPeakIsValid(), MemoryPeakLogicalToDisplay(), MemoryPeakNormalize()
property MemoryUsed as %Integer [ ReadOnly ];
Memory used in KB (Current $s).
Current amount of memory the process has used in KB.
This property requires a mailbox message to be sent to the process being examined.
Property methods: MemoryUsedDisplayToLogical(), MemoryUsedGet(), MemoryUsedIsValid(), MemoryUsedLogicalToDisplay(), MemoryUsedNormalize()
property NameSpace as %String [ ReadOnly ];
Namespace process is executing in.
Property methods: NameSpaceDisplayToLogical(), NameSpaceGet(), NameSpaceIsValid(), NameSpaceLogicalToDisplay(), NameSpaceLogicalToOdbc(), NameSpaceNormalize()
property OSUserName as %String [ ReadOnly ];
Operating system username of process.
Username given to the process by the operating system when the process is created. When displayed, it is truncated to 16 characters. Note that the real O/S username is only returned when connecting to UNIX or VMS systems; For Windows, it will return the O/S username for a console process, but for telnet it will return the $USERNAME of the process. For client connections, it contains the O/S username of the client. This field is truncated at 16 characters.
Property methods: OSUserNameDisplayToLogical(), OSUserNameGet(), OSUserNameIsValid(), OSUserNameLogicalToDisplay(), OSUserNameLogicalToOdbc(), OSUserNameNormalize()
property OpenDevices as %String [ ReadOnly ];
List of open devices.
List of devices which the process has opened. Returned as a comma separated string.
This property requires a mailbox message to be sent to the process being examined.
Property methods: OpenDevicesDisplayToLogical(), OpenDevicesGet(), OpenDevicesIsValid(), OpenDevicesLogicalToDisplay(), OpenDevicesLogicalToOdbc(), OpenDevicesNormalize()
property Pid as %Integer [ Required , ReadOnly ];
Process ID.
Process ID ($J) given to the process by the O/S, decimal form on all platforms.
Property methods: PidDisplayToLogical(), PidGet(), PidIsValid(), PidLogicalToDisplay(), PidNormalize()
property PidExternal as %String [ ReadOnly ];
External Process PID. Decimal value for Windows, Unix and Mac, hex for VMS.
Property methods: PidExternalDisplayToLogical(), PidExternalGet(), PidExternalIsValid(), PidExternalLogicalToDisplay(), PidExternalLogicalToOdbc(), PidExternalNormalize()
property PrincipalDevice as %String [ ReadOnly ];
Principal Device ($P).
This property requires a mailbox message to be sent to the process being examined.
Property methods: PrincipalDeviceDisplayToLogical(), PrincipalDeviceGet(), PrincipalDeviceIsValid(), PrincipalDeviceLogicalToDisplay(), PrincipalDeviceLogicalToOdbc(), PrincipalDeviceNormalize()
property Priority as %Integer [ ReadOnly ];
Priority.
Priority of the process at the O/S level.
Property methods: PriorityDisplayToLogical(), PriorityGet(), PriorityIsValid(), PriorityLogicalToDisplay(), PriorityNormalize()
property PrivateGlobalBlockCount as %Integer [ ReadOnly ];
Number of private global database blocks.
This property contains the # of database blocks currently allocated to store process private globals.
Property methods: PrivateGlobalBlockCountDisplayToLogical(), PrivateGlobalBlockCountGet(), PrivateGlobalBlockCountIsValid(), PrivateGlobalBlockCountLogicalToDisplay(), PrivateGlobalBlockCountNormalize()
property PrivateGlobalReferences as %BigInt [ ReadOnly ];
Number of Process Private Global References.
Total number of private global references the process has made.
Property methods: PrivateGlobalReferencesDisplayToLogical(), PrivateGlobalReferencesGet(), PrivateGlobalReferencesIsValid(), PrivateGlobalReferencesLogicalToDisplay(), PrivateGlobalReferencesNormalize()
property PrivateGlobalUpdates as %BigInt [ ReadOnly ];
Number of Process Private Global Updates.
Total number of private global updates (sets and kills) the process has made.
Property methods: PrivateGlobalUpdatesDisplayToLogical(), PrivateGlobalUpdatesGet(), PrivateGlobalUpdatesIsValid(), PrivateGlobalUpdatesLogicalToDisplay(), PrivateGlobalUpdatesNormalize()
property Roles as %String [ ReadOnly ];
$Roles.
Roles a process currently has.
Property methods: RolesDisplayToLogical(), RolesGet(), RolesIsValid(), RolesLogicalToDisplay(), RolesLogicalToOdbc(), RolesNormalize()
property Routine as %String [ ReadOnly ];
Routine currently executing.
Name of the routine which the process is currently executing.
Property methods: RoutineDisplayToLogical(), RoutineGet(), RoutineIsValid(), RoutineLogicalToDisplay(), RoutineLogicalToOdbc(), RoutineNormalize()
property StartupClientIPAddress as %String [ ReadOnly ];
Startup IP Address of client.
IP address of the client as detected on the TCP channel by the server process.
Property methods: StartupClientIPAddressDisplayToLogical(), StartupClientIPAddressGet(), StartupClientIPAddressIsValid(), StartupClientIPAddressLogicalToDisplay(), StartupClientIPAddressLogicalToOdbc(), StartupClientIPAddressNormalize()
property StartupClientNodeName as %String [ ReadOnly ];
Startup Node Name of client.
IP Node name of the client as detected on the TCP channel by the server process.
Property methods: StartupClientNodeNameDisplayToLogical(), StartupClientNodeNameGet(), StartupClientNodeNameIsValid(), StartupClientNodeNameLogicalToDisplay(), StartupClientNodeNameLogicalToOdbc(), StartupClientNodeNameNormalize()
property State as %String [ ReadOnly ];
State.
Current state of the process as determined by the processes state bits.
The following are all the different states a process can be in. The process may also have a number of different flags within these states which are appended to the end of the state name:
LOCK - Executing a Lock command
OPEN - Opening a device
CLOS - Closing a device
USE - Using a device
READ - Read command
WRT - Write command
GET - Executing a $Get on a global
GSET - Setting a global
GKLL - Killing a global
GORD - $Order on a global
GQRY - $Query on a global
GDEF - $Data on a global
ZF - Executing a $ZF command
HANG - Executing a Hang command
JOB - Executing a Job command
EXAM - Executing a variable exam
BRD - Executing a broadcast
SUSP - Process is suspended
INCR - Executing a $Increment
BSET - Set $bitset
BGET - get $bitset
EVT - Waiting on event RUN - Process is running

Here are the flags which can be appended to the state:

CS - cluster slave job waiting for net answer
NL - Net lock waiting
DT - The dead job has open transaction
S - Suspension requested
GW - Global Wait
NR - Net Read
D - Dead
H - Halting
NH - Netharden
N - Remote network
W - Hibernating
Property methods: StateDisplayToLogical(), StateGet(), StateIsValid(), StateLogicalToOdbc(), StateNormalize()
property Switch10 as %Boolean [ ReadOnly ];
Process Owns switch 10.
This property is set to 1 if the process has set switch 10.
Property methods: Switch10DisplayToLogical(), Switch10Get(), Switch10IsValid(), Switch10LogicalToDisplay(), Switch10Normalize()
property UserInfo as %String (MAXLEN = 16);
User defined information.
This is a user-defined property where the process can set any value into it up to 16 bytes long. The data in it is viewable in JOBEXAM. Note that the information can only be set into one's own process, not into another user's process.
Property methods: UserInfoDisplayToLogical(), UserInfoGet(), UserInfoIsValid(), UserInfoLogicalToDisplay(), UserInfoLogicalToOdbc(), UserInfoNormalize()
property UserName as %String [ ReadOnly ];
$Username of process.
$Username of the process as set by the processes authentication method.
Property methods: UserNameDisplayToLogical(), UserNameGet(), UserNameIsValid(), UserNameLogicalToDisplay(), UserNameLogicalToOdbc(), UserNameNormalize()

Methods

classmethod ExamStackByPid(Pid As %String, GetVariables As %Boolean = 0, Timeout As %Integer = 10) as %Status
Retrieve a snapshot of the execution stack and variables for a process in the same format as JOBEXAM.

Parameters:
Pid - Process ID ($J) of the process to examine
GetVariables - Flag to specify that all variables and their values should be returned
Timeout - How long to wait for the process to respond to the request

Return Value:
On success, the method will return an index of the ^mtemp global (greater than zero).
If an error occurs a status code is returned.
Note that, like JOBEXAM, the request will time out if the process is not executing commands.

The data in the ^mtemp node can be displayed by calling Show^%STACK(index).
It is the responsibility of the caller to Kill ^mtemp(index) when finished with the data.

The data is returned in these nodes of the ^mtemp(index) global:
("*STACK") = the number of stack levels
("*STACK",0,"V",SpecialVar) = the values of special variables such as $S and $ZE
("*STACK",level,"L") = the text line for this level, as displayed by %STACK or JOBEXAM
("*STACK",level,"S") = the source line for this level, with a tilde inserted in front of the current command
("*STACK",level,"I") = the internal data for this level

If variables are requested:
("*LEVEL",level,variable) = the base level of a variable that is visible at this level
("*NAMES",variable,base,level) - this is the same information as *LEVEL in a different format
("*STACK",base,"V",variable) = the value of the variable at its base level
classmethod GetCPUTime() as %String
Get CPU time used for current process.

Returns two comma-delimited pieces, "system" CPU time and "user" CPU time (except on VMS where no separate times are available). Time is returned as milliseconds of CPU time.
classmethod GetLoginRoutine(ByRef Label As %String, ByRef Routine As %String) as %Status
Get routine and label specified in process login.

Available only for the current process, you can not query another process. If a class method is passed on the command line then 'Label' will be the method name and 'Routine' will be the class name with a trailing '#' to identify it as a class.
classmethod GetOSUsername() as %String
This method returns the OSUsername of the process as returned by the operating system. This method differs from the OSUsername property in that it is the actual username assigned to the process by the operating system.
classmethod GetOpenDevices(Pid As %Integer) as %List
Get a $LIST of devices that a process has open.

Parameters:
Pid - Process ID ($J) of the process to examine

Return Value:
On success, the method will return a $LIST of devices that are currently open by the process. The principal device is the first item in the list. The current device has an asterisk appended to the name.
If an error occurs an empty string is returned.
classmethod KillAllPrivateGlobals() as %Status
Kill all process private globals for the calling process.
classmethod NextProcess(Pid As %String, Flag As %Integer = 0) as %String
Returns the next process pid on the system.
This is like a $order function on processes running on the system, similar to the way $ZJOB works. It differs from $zjob in one respect though. If the pid passed into the function has halted before this call, we will still return the next pid on the system. $zjob would return the first pid on the system in this case. Using $zjob in this way with lots of processes starting and halting could lead to inaccurate results. Flag=1 means pass in and return the internal decimal representation of a VMS pid ($zh(pid))
classmethod Open(Id As %String, concurrency As %Integer = -1, ByRef sc As %Status = 1) as %ObjectHandle
Open an instance to a process.
This method will open an instance to a process by passing either a PID or Job number to the method. A Pid can either be directly passed in or prefaced with a "P". A Job number can be passed in prefaced by a "J".
The following open an instance to a process with a pid = 2078:
s Process=##CLASS(%SYS.ProcessQuery).Open("P2078")
s Process=##CLASS(%SYS.ProcessQuery).Open("2078")

The following will open Job number 23

s Process=##CLASS(%SYS.ProcessQuery).Open("J23")

Parameters:
Id - Pid or Job number to open
Concurrency - Pass -1 or use default
sc (by ref)- Status of the Open
Return values:
On success, the method returns an object handle to the opened process.
On failure, the method returns a null string, and an error in sc.

Queries

query AllFields()
SQL Query:
SELECT * FROM %SYS.ProcessQuery
Returns ALL properties for a process
This query performs a Select * on %SYS.ProcessQuery SQL query. Note that this query uses a $v(-1,$j) mailbox message to query processes. This causes a lot of overhead, but is necessary in order to return all fields. Use the JOBEXAM, CONTROLPANEL, or SS query for less overhead. This query will change in future versions as field are added or removed.
query CONTROLPANEL(JobNumber As %Integer = 1, Filter As %String = "")
Selects Job# As %Integer, Pid As %Integer, DisplayPID As %Integer, Username As %String, Device As %String, Nspace As %String, Routine As %String, Commands As %BigInt, Globals As %BigInt, State As %String, Client Name As %String, EXE Name As %String, IP Address As %String, Can Be Examined As %Boolean, Can Be Suspended As %Boolean, Can Be Terminated As %Boolean, Can Receive Broadcast As %Boolean, PrvGblBlkCnt As %Integer, OSUserName As %String
Returns fields for the Management Portal display
Note that this query does not use a $v(-1,$j) mailbox message to query processes. This avoids unecessary overhead. This query may change in future versions.
Parameters:
JobNumber - Job number of where to start the query, default = 1 (first job)
Filter - Display processes which contain this filter in the line, "" means display all. For example, if Filter="READ", this will only display processes which have the word "READ" in one of the columns.
query CONTROLPANELVMS(JobNumber As %Integer = 1, Filter As %String = "")
Selects Job# As %Integer, Pid As %String, DisplayPID As %String, Username As %String, Device As %String, Nspace As %String, Routine As %String, Commands As %BigInt, Globals As %BigInt, State As %String, Client Name As %String, EXE Name As %String, IP Address As %String, Can Be Examined As %Boolean, Can Be Suspended As %Boolean, Can Be Terminated As %Boolean, Can Receive Broadcast As %Boolean, PrvGblBlkCnt As %Integer, OSUserName As %String
Same as CONTROLPANEL Query except that Pid column is a %string.
query JOBEXAM(JobNumber As %Integer = 1)
Selects Job# As %Integer, Nspace As %String, Routine As %String, Commands As %BigInt, Globals As %BigInt, State As %String, Pid As %String, Current Device As %String
Returns fields for the JOBEXAM display.
Note that this query does not use a $v(-1,$j) mailbox message to query processes. This avoids unecessary overhead. This query may change in future versions.
Parameters:
JobNumber - Job number of where to start the query, default = 1 (first job)
query ListPids(JobNumber As %Integer = 1)
Selects Pid As %String
Return PIDS for all processes running on the system.
This query returns the internal pid for each process on the system. This pid can then be passed directly to the %OpenId() method, or as an argument to an embedded SQL query which does a SELECT based on the Pid. See the example above for SQL useage.
Parameters:
JobNumber - Job number of where to start the query, default = 1 (first job)
query PPG(filter As %String = "*", pid As %Integer = -1, options As %String = "")
Selects key, name As %String, value As %String, blocks As %String
Select information about Process Private Globals.

The 'filter' parameter can be a variable name definition and/or subscript definition, using * as wildcards. A filter name of '*' will return all PPG variables for that process id.
As an example of using the wildcards, a filter specification of "CUST*(12*,*COOP*" would mean return all PPG variables whose name starts with CUST, that have 2 or more subscripts, the first subscript must start with 12, the second subscript must contain COOP.

pid can be any valid process id, or -1 for the caller's process.

options can be one or more of the following characters
"N" Do not return subscripts of a PPG, just return the root name
"B" Return the number of blocks used by the PPG (needs the "N" option)
"b" Returns the number of bytes used by the PPG (needs the "N" option)

Example
set rs=##class(%ResultSet).%New("%SYS.ProcessQuery:PPG")
do rs.Execute("*",$J,"NB")
for {
q:'rs.Next()
w "PPG name "_rs.GetData(1)_" is using "_rs.GetData(3)_" disc blocks",!
}
This query requires the %Admin_Manage:Use permission to execute.
query SS(JobNumber As %Integer = 1)
Selects Process As %Integer, JobType As %Integer, Device As %String, Namespace As %String, Routine As %String, CPU As %BigInt, Glob As %BigInt, Pr As %Integer, User As %String, Location As %String
Returns fields for the %SS display
Note that this query does not use a $v(-1,$j) mailbox message to query processes. This avoids unecessary overhead. This query may change in future versions.
Parameters:
JobNumber - Job number of where to start the query, default = 1 (first job)
query Top(Sort As %String = "COMMANDS", Number As %Integer = 10)
Selects Process As %Integer, JobType As %Integer, Device As %String, Namespace As %String, Routine As %String, CPU As %BigInt, Glob As %BigInt, Pr As %Integer, User As %String, Location As %String
Returns the top Processes as measured by the recent activity of either CommandsExecuted or GlobalReferences

Parameters:
Sort - sort by "COMMANDS" (default) or "GLOREFS"
Number - number of processes to list. Default is 10 and max is 50

Note that the evaluation of the actual 'top' process list is handled by the Application Monitor (%MONAPP) using the %Monitor.System.Dashboard2 class. This is 'on' by default and can be managed using the %MONAPPMGR utility. Also, the counts of CommandsExecuted and GlobalReferences returned are for the latest sample period and not the total for the life of the process.
query TopGlobal(Sort As %String = "REFS", Number As %Integer = 20, Seconds As %Integer = 5)
Selects Process As %Integer, User As %String, Namespace As %String, Routine As %String, JobType As %Integer, GloRefs As %BigInt, PhysReads As %Integer, GloUpdates As %Integer, BlkAlloc As %Integer, PPGBlks As %Integer
Returns the top Processes for certain types of database activity for the next 'n' seconds. The query can be sorted by one of the following properties: 'GlobalReferences', 'GlobalUpdates', 'GlobalDiskReads', 'GlobalBlocks', or 'PrivateGlobalBlockCount'.

Parameters:
Sort - sort by "REFS", "UPDATES", "READS", "BLOCKS", "PPG". Default is "REFS".
Number - number of processes to list. Default is 20.
Seconds - number of seconds to wait. Default is 5 seconds.

The query will fetch the values for all processes, wait for 'n' seconds, and then fetch the values again. It will return the list of the 'top' processes for the selected 'Sort' property, and the delta values for properties over that time period. Note that PrivateGlobalBlockCount is returned as the total number used, not a delta.
query VariableByJobNumber(JobNumber, VariableName As %String, Format As %Integer, MaxRows As %Integer, Filter As %String)
Selects Name As %String, Value As %CacheString
Returns the variables of a process
Pass VariableName as a null string to return all variables. This query requires the %Admin_Manage:Use permission to execute. Parameters:
JobNumber - Job number to query.
NOTE: You may not use this query to examine your own job.
VariableName - Variable to return, or ""=All
Format - Bit string of how to format the variable data, default = 0 (no formattimg)
Bit 0 - Format the data with $c() and $lb() notation
Bit 1 - Embed bolded cursor sequences around $c() and $lb() notation
MaxRows - Maximum number of rows to return
Filter - Filters the data returned (case insensitive). If the variable contains the filter, then return it. ""=no filter
This query may change in future versions.
query VariableByPid(Pid As %String, VariableName As %String, Format As %Integer, MaxRows As %Integer, Filter As %String)
Selects Name As %String, Value As %CacheString
Returns the variables of a process, PID is decimal value for all platforms.
Pass VariableName as a null string to return all variables. This query requires the %Admin_Manage:Use permission to execute. Parameters:
Pid - Pid of process to query
VariableName - Variable to return, or ""=All
Format - Bit string of how to format the variable data, default = 0 (no formattimg)
Bit 0 - Format the data with $c() and $lb() notation
Bit 1 - Embed bolded cursor sequences around $c() and $lb() notation
MaxRows - Maximum number of rows to return
Filter - Filters the data returned (case insensitive). If the variable contains the filter, then return it. ""=no filter
Note that the fields returned here may change or be removed in future versions.

Indexes

index (IdKey on Pid) [IdKey, Type = key];
Index on Pid field.
Uses NextProcess(Pid) to retrieve next process id.
Index methods: IdKeyCheck(), IdKeyDelete(), IdKeyExists(), IdKeyOpen(), IdKeySQLCheckUnique(), IdKeySQLExists(), IdKeySQLFindPKeyByConstraint(), IdKeySQLFindRowIDByConstraint()

Inherited Members

Inherited Methods

Storage

Storage Model: CacheSQLStorage

Maps: 1

  • Map number 1 is named Map1

    thismap.Global:

  • ({Pid})
    =
    Node Delimiter Piece Name
    Username
FeedbackOpens in a new tab