Solved

how can i know what is the time that it takes the script to run and finsh ?

Posted on 2008-09-29
4
203 Views
Last Modified: 2008-09-29
how can i know what is the time that it takes the script to run and finsh ?
0
Comment
Question by:mgtm3
4 Comments
 
LVL 8

Accepted Solution

by:
MatthiasVance earned 300 total points
ID: 22597585
You can use the gettimeofday() function on the beginning and the end of your script, like this.

Kind regards,

Matthias Vance
<?php
	$start = gettimeofday(true);
	// Your code here.
	$end = gettimeofday(true);
	$duration = $end - $start;
	echo "Duration: " . $duration;
?>

Open in new window

0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 75 total points
ID: 22597658
0
 
LVL 109

Assisted Solution

by:Ray Paseur
Ray Paseur earned 75 total points
ID: 22597993
I use this...
<?php
// SCRIPT TIMER AT START OF SCRIPT
list ($x, $y) = explode(" ", microtime()); $script_start_time = $x + $y;
 
/* EXECUTE SCRIPT HERE */
 
// AT END OF SCRIPT
list ($x, $y)		= explode(" ", microtime());
$script_stop_time	= $x + $y;
$script_duration	= number_format( ($script_stop_time - $script_start_time) ,3);
echo "$script_duration Seconds";
?>

Open in new window

0
 
LVL 9

Assisted Solution

by:khaledf
khaledf earned 50 total points
ID: 22598116
I use this code:
put your page code between these 2 php blocks
<?  $time = microtime(true);  ?>  
 
 
 
<?   
$time2 = microtime(true);   
$gentime = $time2 - $time;
echo "$gentime";
?>

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP strings vs array errors 13 32
limit a company to search only coupons for that particular company 6 30
jQuery force form POST 7 44
Ajax and PHP 9 29
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question