Showing posts with label processing time. Show all posts
Showing posts with label processing time. Show all posts

4/22/2022

Measuring processing time python

 Measure processing time


..

#metho #1
import time
start = time.time()
print("hello")
end = time.time()
print(end - start)


#method #2
from timeit import default_timer as timer
start = timer()
# ...
end = timer()
print(end - start) # Time in seconds, e.g. 5.38091952400282

..


Thank you.

www.marearts.com


9/21/2020

python measure processing time

 


from time import process_time
# Start the stopwatch / counter
t1_start = process_time()

###
#processing
###

# Stop the stopwatch / counter
t1_stop = process_time()
sec = t1_stop-t1_start


10/23/2013

Window function GetTickCount, OpenCV function getTickCount (example source code)

Do not confuse,
GetTickCount and getTickCount is different function.
The first is ms window function.
The second is openCV function.
The method to use is little bit different.
Show example source code~!
-----------------------

unsigned long Atime=0, Btime=0;
unsigned long AAtime=0, BBtime=0;


Atime = GetTickCount();
AAtime = getTickCount();


someFunctionTakeLongTime(); //Test function


Btime = GetTickCount();
BBtime = getTickCount();


printf("%.2lf \n",  (Btime - Atime)/1000.0 );
printf("%.2lf \n",  (BBtime - AAtime)/getTickFrequency() );

-----------------------
Be careful when you use this function.