TotalElapsedMilliseconds: Integer;
The TotalElapsedMilliseconds property determines a total algorithm calculation time.
Executing the example requires that the repository contains a ready calculation algorithm with the ALGORITHM identifier. The calculation algorithm should contain configured objects.
Add links to the Algo and Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo: ICalcObject;
CalcAlgo: ICalcAlgorithm;
CalcResult: IAlgorithmCalculationResult;
Sec: Double;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Calculate algorithm
CalcResult := CalcAlgo.Calculate;
// Display calculation result in the console
Sec := CalcResult.TotalElapsedMilliseconds/1000;
Debug.WriteLine("Total time of algorithm calculation: " + Sec.ToString + " sec");
Sec := CalcResult.InitMilliseconds/1000;
Debug.WriteLine("Initialization time: " + Sec.ToString + " sec");
Sec := CalcResult.ElapsedMilliseconds/1000;
Debug.WriteLine("Time of objects calculation: " + Sec.ToString + " sec");
End Sub UserProc;
After executing the example, the calculation algorithm is calculated. The console displays the calculation result, for example:
Total time of calculation algorithm execution: 0.078 sec
Initialization time: 0.031 sec
Objects calculation time: 0.031 sec
See also: