Timer: Difference between revisions

Jump to navigation Jump to search
99 bytes added ,  8 December 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 1: Line 1:
Get the execution time of the script or sql query was executed.
Get the execution time of the script or sql query was executed.


== PHP ==
[http://stackoverflow.com/questions/8310487/start-and-stop-a-timer-php Start and stop a timer PHP - Stack Overflow]


PHP: [http://stackoverflow.com/questions/8310487/start-and-stop-a-timer-php Start and stop a timer PHP - Stack Overflow]


 
== MySQL ==
MySQL: Recording the time elapsed after the sql query was executed.
Recording the time elapsed after the sql query was executed.
<pre>
<pre>
SELECT @timer := CURRENT_TIMESTAMP();
SELECT @timer := CURRENT_TIMESTAMP();
Line 12: Line 13:
</pre>
</pre>


 
== Linux command ==
{{Linux}} or Cygwin commands on {{Win}}<ref>[http://stackoverflow.com/questions/385408/get-program-execution-time-in-the-shell linux - Get program execution time in the shell - Stack Overflow]</ref>
{{Linux}} console, {{Mac}} Terminal or Cygwin commands on {{Win}}<ref>[http://stackoverflow.com/questions/385408/get-program-execution-time-in-the-shell linux - Get program execution time in the shell - Stack Overflow]</ref>
<pre>
<pre>
START=$(date +%s)
START=$(date +%s)
# sleep 2 seconds for testing purpose
sleep 2s
sleep 2s
END=$(date +%s)
END=$(date +%s)
DIFF=$(( $END - $START ))
DIFF=$(( $END - $START ))
echo "Elapsed time $DIFF seconds"
echo "Elapsed time $DIFF seconds"
</pre>
</pre>


 
== Python ==
Python: [http://stackoverflow.com/questions/7370801/measure-time-elapsed-in-python performance - Measure time elapsed in Python? - Stack Overflow]
[http://stackoverflow.com/questions/7370801/measure-time-elapsed-in-python performance - Measure time elapsed in Python? - Stack Overflow]




Navigation menu