Execution Tracking and Time Measurement
You can track the execution of a procedure and make some time measurement using the
DebugTimer primitive and complete instructions.
Important:
To use the DebugTimer primitive, add var
DebugTimer = Java.type
(“com.dassault_systemes.completionServices.base.DebugTimer”); in the Header Section of your procedure. |
Definition of the Instructions
You must also add the following statements to the Body Section of your procedure:
- Before the method to be measured:
var MyTimer = new DebugTimer (context, traceLevel, text, traceFormat); - After the statement to be measured:
MyTimer.complete ();Where:
MyTimeris a user-defined name for this time measurement step.contextis the Completion Context of the procedure.traceLevelis a value that defines the level of the traces. The possible values are0and1:- If the value is
0, then the corresponding trace will be output as soon as theCompletionServicesTracestrace is define to0. - If the value is
1, then the corresponding trace will be output as soon as theCompletionServicesTracestrace is define to1.Recommendation: DefinetraceLevelto0.
- If the value is
traceFormatis a text that defines the format of the output trace. The possible values aretrueandfalse:- If
true, then the trace will be written on two lines: the first line starting with "Begin" followed by the text defined in statement and time, and the second line starting with "End". - If
false, then the trace will be written on one line as follows: the line starting with "Did" followed by the text, then "in", and finally the required time.Recommendation: DefinetraceFormattotrue.Example:
Did primitive in n ms (started at p ms)Where:
primitiveis the text.nis the time to execute the primitive.pis the start time (in milliseconds).
- If
Activation and Localization of Traces
If no variable is defined, no traces are generated.
To track the execution, you must declare the CompletionServicesTraces
variable in the mxEnvCAS.sh file located in
/home/data/RTV/serverName/server/scripts.
Where:
serverNameis the name of the server.
The declaration of the CompletionServicesTraces variable must be as
follows:
CompletionServicesTraces=0 export CompletionServicesTraces
Where:
- If
CompletionServicesTraces=0, it triggers the traces of the procedure, defined by the administrator through theDebugTimerinstructions. - If
CompletionServicesTraces=1, it triggers the traces of the procedure and internal traces to the primitives used.
Once you have modified the mxEnvCAS.sh file, you must restart the Tomcat.
You can find the results file with the retrieved traces in the catalina.out file.
Exploitation of the Traces
Depending on the value of the traceFormat parameter, the output is different.
- If
true, then the trace will be written on two lines: the first line starting with "Begin" followed by the text defined in statement and time, and the second line starting with "End".Between these two lines, you can have other
DebugTimerinstructions nested in the previous ones and indented with minus-signs for better readability.The "
-Begin" and the "-End" of a nested instruction are read in pairs at the same level to indicate the beginning and the end of a primitive or step in the primitive. - If
false, then the trace will be written on one line as follows: the line starting with "Did" followed by the text, then the required time.Example:
Did primitive in n ms (started at p ms)Where:
primitiveis the text.nis the time to execute the primitive.pis the start time (in milliseconds).