How correctly evaluate script execution time? RRS feed

  • Question

  • I'm running test of the script which computes it's own duration as ($StopDate-$StartDate).TotalMilliseconds but it uses multitheading. $StartDate time stamp is created before multithread code starts and $StopDate - after all threads finished. The same algorithm is used by the test-code which runs "& powershell.exe -mta $scriptName". It appeared that INTERNAL duration is TWICE less then those computed by the test-code. Could anybody explain this difference?

    Seems I've got: test knows nothing about the script executed and it computes full duration since command was started till command was finished and this time includes milliseconds necessary to start "powersell.exe -mta", run the script and terminate execution. That is BY CHANCE this duration appeared to be twice as big as a script duration - run the script minutes instead of the seconds, the diffirence would be negligable. Thus I CAN BELEIVE internally computed duration.

    • Edited by Oleg Kulikov Sunday, August 19, 2018 8:13 PM
    • Moved by Bill_Stewart Wednesday, December 12, 2018 6:15 PM Unanswerable drive-by question
    Sunday, August 19, 2018 3:35 PM