IAlgorithmTimeResult.ExecuteMilisecods

Syntax

ExecuteMilisecods: Integer;

Description

The ExecuteMilisecods property returns object calculation execution time.

Example

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;
    CalcObj: IAlgorithmTimeResults;
    Obj: IAlgorithmTimeResult;
    i: Integer;
    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;
    // Get objects calculation result
    CalcObj := CalcResult.Calc;
    For i := 0 To CalcObj.Count-1 Do
        Obj := CalcObj.Item(i);
        Debug.WriteLine("Name: " + Obj.Name);
        Debug.WriteLine("Identifier: " + Obj.Id);
        Debug.WriteLine("Key: " + Obj.Key.ToString);
        Sec := Obj.ExecuteMilisecods/1000;
        Debug.WriteLine("Calculation time: " + Sec.ToString + " sec");
        Debug.WriteLine("");
    End For;
    Debug.WriteLine("Total calculation time of all objects: " + CalcObj.TotalTime.ToString + " ms.");
End Sub UserProc;

After executing the example, calculation algorithm objects are calculated. The console displays the calculation result, for example:

Name: Calculation block

Identifier: CALC

Key: 230593

Calculation time: 0.057 sec

 

Name: Control block

Identifier: CONTROL

Key: 230831

Calculation time: 0.018 sec

 

Total time of calculation of all objects: 75 ms.

See also:

IAlgorithmTimeResult