1. Stopwatch

    Article: AN0001646Updated:

    This object is used for an accurate measuring of script speed.

    If you need to perform an optimization of data processing by means of scripts, this object may be used for an accurate measurement of various processing methods and find a place with the biggest time burden and an optimal option of processing.

     

    Name Description
    TimeSpan Elapsed Time from the timer start.
    long ElapsedMilliseconds Time from the timer start in miliseconds.
    bool IsRunning Indication, whether the timer is running.
    void Reset() Method sets the timer to null.
    void Restart() Method resets the timer.
    void Start() Method starts the timer.
    void Stop() Method stops the timer.

    Příklad

    var sw = OG.Utils.CreateStopwatch();
    sw.Start();

    ... tested script

    sw.Stop();

    //write to log
    OG.Log.Write('Elapsed: ' + sw.Elapsed);
    OG.Log.Write('Elapsed in miliseconds: ' + sw.ElapsedMilliseconds);

×