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 difference)

Revision as of 12:28, 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

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