Python Forum
How to measure execution time of a multithread loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to measure execution time of a multithread loop
#1
I have a small app that does work on about 100 loops each on a new thread. How can I measure the total execution time from the point where the app started to run to the point where the last thread completed?

If I do a print(endtime - starttime) after the last loop, the threads are still running for about 10 seconds. So the end of the last loop is not when the app is finished running.

Thank you.
Reply
#2
You can use time.perf_counter() to get your start and end times, but timeit() may be a better match for what you want to do. See the docs
Reply
#3
Thanks. I will look into that.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  measure diameter of complex structure alminnawi 0 162 Apr-18-2024, 10:20 AM
Last Post: alminnawi
  How can I multithread to optimize a groupby task: davisc4468 0 709 Jun-30-2023, 02:45 PM
Last Post: davisc4468
  PyCharm Script Execution Time? muzikman 3 8,466 Dec-14-2020, 11:22 PM
Last Post: muzikman
  How to to tie the execution of one process to another inside a loop in Python ignorant_wanderer 0 2,049 Jul-11-2020, 03:44 AM
Last Post: ignorant_wanderer
  Updating a matrix in a time interval inside a for loop vp1989 4 2,896 May-17-2020, 07:15 PM
Last Post: vp1989
  A better way to limit loop execution? t4keheart 3 2,702 Feb-26-2020, 08:24 AM
Last Post: DeaD_EyE
  Loop independent of excecution time of a script Forelli 8 3,804 Feb-02-2020, 10:49 PM
Last Post: snippsat
  Why the multithread does not reduce the execution time? Nicely 2 2,490 Nov-23-2019, 02:28 PM
Last Post: Nicely
  How to Display Multiple Time Tables With While Loop ZQ12 2 2,166 Nov-10-2019, 04:15 AM
Last Post: ZQ12
  Define unit of measure of a number doug2019 3 2,391 Oct-15-2019, 03:43 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020