473,379 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

how to find the time taken to execute php script

Is there any function or variable that return the time taken to
execute a part or full php script .
Jun 2 '08 #1
3 8038
sivaji a écrit :
Is there any function or variable that return the time taken to
execute a part or full php script .
No, but you can use microtime() to generate a timer at the start and at
the end of your page, and minus them.

Regards,
--
Guillaume
Jun 2 '08 #2
sivaji escribió:
Is there any function or variable that return the time taken to
execute a part or full php script .
Apart from microtime(), if your PHP version is great or equal than 5.1.0
you should have a variable called $_SERVER['REQUEST_TIME'] that contains
a Unix timestamp of when the request was received. That allows you to
count time until the first line of the script is actually executed.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 2 '08 #3
On May 14, 7:16*pm, "Álvaro G. Vicario"
<alvaroNOSPAMTHA...@demogracia.comwrote:
sivaji escribió:
Is there any function or variable that return the time taken to
execute a part or full php script .

Apart from microtime(), if your PHP version is great or equal than 5.1.0
you should have a variable called $_SERVER['REQUEST_TIME'] that contains
a Unix timestamp of when the request was received. That allows you to
count time until the first line of the script is actually executed.
ya i got the actual code i need ,

<?php
$time_start = microtime(true);

// Sleep for a while
usleep(100000);

$time_end = microtime(true);
$time = $time_end - $time_start;

echo "Did nothing in $time seconds\n";
?>

thanks to all
Jun 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Damien | last post by:
Hello to all, I've written a script that take quite a long time to execute (email sending). Last time I ran it, PHP gave me a "execution time limit exceeded" (or something like that), so I changed...
1
by: Anzu | last post by:
I've been working on a script that finds and updates a record in database based on the user's input. When I try it I get this error: Active Server Pages, ASP 0113 (0x80004005) The maximum...
1
by: Fabian | last post by:
I notice on http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndude/html/dude100499.asp that the writer has measured the time taken to run the script down to the millisecond. ...
1
by: Simon Wadsworth | last post by:
My application uses VB6 WebClasses to handle the UI, so all requests come in via a stub ASP page. I would like to know the time taken for the request to be processed. I am trying to use the...
11
by: srkkreddy | last post by:
Hi, I have written a large program which makes multiple calls to number of functions (also written by me) of the program. Now, I want to know the collective time taken by all the calls to a...
0
by: oliver | last post by:
QUESTION: How to access an object embedded in a UserControl through Javascript file? Another way to ask this question: How to execute script from a UserControl, accessing other objects in that...
8
by: saurabh.ss | last post by:
Hi I want to measure the time required to execute a piece of code. For example, I want to know the time required to execute a given function. How do I do it within C++? I know I got to use a...
2
by: cylin | last post by:
Hi, I am currently doing a project regarding image processing. I had facing problem writing C++ code to calculate time taken to execute a function. Can somebody help me on this. thanks. ...
1
by: Channveer | last post by:
how to write the C code in Linux to find the time taken by the binary search algorithm ?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.