The profiler reports information about how much time is spent in different sections of a Mission Plan. Profiler information is reported to a scopes file and a lines file. The profiler can help debug and optimize Mission Plans by tracking the execution time of different sections in the Mission Plan. This switch is used in conjunction with the Mission Plan switch.
ff --mission-plan <PATH TO FILE> --use-profiler
Profile default.MissionPlan and report information about the execution time.
FF.exe -up -mp default.MissionPlan
ff -up -mp default.MissionPlan
The Profiler creates a scopes file and a lines file. These files are written to the same directory as the Mission Plan and have the Mission Plan's full name followed by "_profile_" prepended to their names. For example, if your Mission Plan were named "Test.MissionPlan", then the scopes and lines files would be named "Test.MissionPlan_profile_scopes.txt" and "Test.MissionPlan_profile_lines.txt", respectively. For purposes of both of the following lines and scopes example files, the following script was passed as a Mission Plan to FreeFlyer's Profiler.
Define Procedure CalculateSquare(Variable x, Variable y);
y = x*x;
For i = 0 to 2;
If (i > 1);
j = 8;
j = 3;
Call CalculateSquare(j, k);
Report i, k;
Note: Since this command line switch only works with FF.exe, the profiler results do not include the time that would be spent generating any output views (PlotWindows, DataTableWindows, Consoles, etc.) that would be available with FreeFlyer.exe.
The scopes file lists information about the execution time of the Main Scope, Procedures, and Macros.
oThe Main Scope or Procedure or Macro name being analyzed.
oOnly includes the time spent executing the lines in the current scope, not the time spent executing sub-Procedures.
oNote: This time does include time spent executing any Macros called by this Procedure.
oIncludes the time executing the scope (Procedure or Main Scope) and the time spent executing any sub-scopes that are called by this scope (sub-Procedures and Macros).
oThe inclusive time for the Main Scope will be the total amount of time spent executing the Mission Plan.
oTotal number of times a Procedure was called.
Below is a sample of what a scopes file would look like for a Mission Plan containing the above script.
Procedure Exclusive(s) Inclusive(s) Hits
CalculateSquare 0.000004226 0.000004226 1
Main Scope 0.000053428 0.000057654 1
The lines file lists information about the execution time for each line of code. The Lines file will be ordered based on line appearance in the Mission Plan as in the following example.
oThe execution time for the line of code. The time recorded on each line in the lines file is exclusive
oNote: The time recorded for a Call command that calls a Procedure only includes the actual time spent on the Call line and not the entire time executing the Procedure.
oTotal number of times a line was called.
oThe script line being analyzed.
oMission Sequence or Procedure file line number of the script line.
oColumn number for the line.
oNote: If your Mission Plan uses spaces instead of tabs, this value will be indicative of the indent level of the current line being analyzed.
oScope name (Main Scope, Procedure, or Macro Name).
oSource of the script line.
Below is a sample of what a lines file would look like for a Mission Plan containing the above script.
Time(s) Hits Script Line Column Scope Source
0.000001208 3 y = x*x 2 5 CalculateSquare MissionPlan
0.000003018 3 EndProcedure 3 1 CalculateSquare MissionPlan
0.000010264 1 Variable i 5 1 Main Scope MissionPlan
0.000000906 1 Variable j 6 1 Main Scope MissionPlan
0.000000905 1 Variable k 7 1 Main Scope MissionPlan
0.000004226 4 For i = 0 to 2 9 1 Main Scope MissionPlan
0.000002717 3 If (i > 1) then 10 5 Main Scope MissionPlan
0.000000302 1 j = 8 11 9 Main Scope MissionPlan
0.000000905 2 j = 3 13 9 Main Scope MissionPlan
0.000001208 3 End 14 5 Main Scope MissionPlan
0.000001208 3 i++ 15 5 Main Scope MissionPlan
0.000009055 3 Call CalculateSquare(j, k) 16 5 Main Scope MissionPlan
0.000020828 3 Report i, k 17 5 Main Scope MissionPlan
0.000000904 3 End 18 1 Main Scope MissionPlan