Timer: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
(Created page with "PHP: [http://stackoverflow.com/questions/8310487/start-and-stop-a-timer-php Start and stop a timer PHP - Stack Overflow] MySQL: Recording the time elapsed after the sql quer...")
 
No edit summary
Line 10: Line 10:




{{Linux}} or Cygwin commands on {{Win}}
{{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>
<pre>
<pre>
START=$(date +%s)
START=$(date +%s)
Line 21: Line 21:


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


[[Category:Programming]] [[Category:PHP]] [[Category:MySQL]] [[Category:Tool]]
[[Category:Programming]] [[Category:PHP]] [[Category:MySQL]] [[Category:Tool]]

Revision as of 12:29, 8 December 2016

PHP: Start and stop a timer PHP - Stack Overflow


MySQL: Recording the time elapsed after the sql query was executed.

SELECT @timer := CURRENT_TIMESTAMP();
SELECT SLEEP(2); /* sleep 2 seconds for testing purpose */
SELECT 'custom message' AS 'action', CURRENT_TIMESTAMP() AS 'end time', @timer AS 'start time', TIMEDIFF(CURRENT_TIMESTAMP(), @timer) AS 'time elapsed';


Linux Os linux.png or Cygwin commands on Win Os windows.png [1]

START=$(date +%s)
sleep 2s
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "Elapsed time $DIFF seconds"


Python: performance - Measure time elapsed in Python? - Stack Overflow


References