473,545 Members | 757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8047
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"
<alvaroNOSPAMTH A...@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
3643
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 the value in php.ini. Now, the questions are : - How can I make sure I'm not going to have problems when execution time lengthens still ? I'm...
1
2176
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 amount of time for a script to execute was exceeded. Yo can change this limit by specifying a new value for the propert Server.ScriptTimeout or by...
1
2283
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. Does anyone know what tools he used to calculate these load times? -- --
1
4327
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 time-taken value in the IIS log files by I am unclear as to the precise meaning of the value recorded. Using a test WebClass on a development PC...
11
3229
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 specific function. Is there any way I can find this time. Thanks in advance, Raja Kiran Sandireddy.
0
2083
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 UserControl? (Script attached to, and executed by, a UserControl embedded server control can ‘see’ the UserControl through the root document...
8
46791
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 library called ctime. But I dont know what functions to use. Please tell me.
2
7919
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. #include "picture.h" #include <iostream> using namespace std; int main()
1
1615
by: Channveer | last post by:
how to write the C code in Linux to find the time taken by the binary search algorithm ?
0
7456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7744
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3437
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
692
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.