4D v14.3

GET ACTIVITY SNAPSHOT

Home

 
4D v14.3
GET ACTIVITY SNAPSHOT

GET ACTIVITY SNAPSHOT 


 

GET ACTIVITY SNAPSHOT ( arrActivities | arrUUID ; arrStart ; arrDuration ; arrInfo {; arrSubOp}{; *} ) 
Parameter Type   Description
arrActivities | arrUUID  Object array, Text array in Complete description of operations (object array) or
Operation UUIDs (text array)
arrStart  Text array in Operation start times
arrDuration  Longint array in Operation durations in seconds
arrInfo  Text array in Description
arrSubOp  Object array in Sub-operations
Operator in If passed = Get server activity

The GET ACTIVITY SNAPSHOT command returns a single or several arrays describing operations in progress on the 4D data. These operations usually display a progress window. 

This command is used to get a snapshot of the x operations that are most time-consuming and/or run most frequently, such as cache writing or the execution of formulas.

Note: The information returned by the GET ACTIVITY SNAPSHOT command is the same as that displayed on the "Real Time Monitor" (RTM) page of the 4D Server administration window (see 4D Server Reference Guide).

By default, GET ACTIVITY SNAPSHOT processes operations performed locally (with 4D single-user, 4D Server or 4D in remote mode). However, with 4D in remote mode, you can also get a snapshot of operations performed on the server: you just need to pass the asterisk (*) as the last parameter. In this case, the server data is recovered locally.
The * parameter is ignored when the command is executed on 4D Server or 4D single-user. 

The GET ACTIVITY SNAPSHOT command accepts two syntaxes:

  • syntax using only an object array.
  • syntax using several arrays.

With this syntax, all the operations are returned in a structured form in the 4D object array (arrActivities). Each element of the array is an object built as follows:

[
    {
        "message":"xxx",
        "maxValue":12321,
        "currentValue":63212,
        "interruptible:0,
        "remote":0,
        "uuid":"deadbeef",
        "taskId":xxx,
        "startTime":"2014-03-20 13:37:00:123",
        "duration":92132,
        "subOperations":[
            {"message":"xxx",
            ...}
            ]
    },
    {...}
]

Here is a description of each property returned:

  • message (text): label of operation
  • maxValue (number): number of iterations set for the operation (-1 if non-iterative operation)
  • currentValue (number): current iteration
  • interruptible (number): operation can be interrupted by user (0=true, 1=false)
  • remote (number): operation paired between client and server (0=true, 1=false)
  • uuid (text): UUID identifier of operation
  • taskId (number): Internal identifier of the process at the origin of the operation
  • startTime (text): start time of operation in the "yyyy:mm:dd hh:mm:ss:mls" format
  • duration (number): duration of operation in milliseconds
  • subOperations (array): array of objects containing sub-operations of the current operation (if any). The structure of each sub-element is identical to the one in the main object. If the current operation does not have any sub-operations, then subOperations is empty.

With this syntax, all the operations are returned in several synchronized arrays (each operation causes an element to be added to all of the arrays). The following arrays are returned:

  • arrUUID: contains the UUIDs for each operation (corresponds to the uuid property of the arrActivities object in the previous syntax).
  • arrStart: contains the start times for each operation (corresponds to the startTime property of the arrActivities object).
  • arrDuration: contains the durations of each operation in milliseconds (corresponds to the duration property of the arrActivities object).
  • arrInfo : contains the labels describing each operation (corresponds to the message property of the arrActivities object).
  • arrSubOp (optional): each element of this array is an object containing the "subOperations" property. The value of this property is an object array containing all the sub-operations for the current operation. If the current operation does not have any sub-operations, the value of the subOperations property is an empty array (corresponds to the subOperations property of the arrActivities object).

Example  

This method, executed in a separate process on 4D or 4D Server, provides a snapshot of the operations that are underway:

 ARRAY TEXT(arrUUID;0)
 ARRAY TEXT(arrStart;0)
 ARRAY LONGINT(arrDuration;0)
 ARRAY TEXT(arrInfo;0)
 
 Repeat
    GET ACTIVITY SNAPSHOT(arrUUID;arrStart;arrDuration;arrInfo)
    If(Size of array(arrUUID)>0)
       TRACE // calling of debugger
    End if
 Until(False// Infinite loop

You get arrays such as:

 
PROPERTIES 

Product: 4D
Theme: Tools
Number: 1277

 
HISTORY 

New
Created: 4D v14

 
SEE ALSO 

Real Time Monitor Page

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14.3)

Parent of : GET ACTIVITY SNAPSHOT ( 4D v14 R3)