473,473 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to get the time spent on a request from PHP?

I would like to write the spent time for a mysql select, in the style
of Google's searches: "x results found for xxxxxx in xx secs".

How could i get the spent time from my PHP code? When you do a mysql
statement on a terminal this is shown at the end of the results, but i
can't find how to get this from PHP.
Jul 20 '05 #1
1 2866
On 14 Jul 2004 05:13:52 -0700, an********@yahoo.es (Justo) wrote:
How could i get the spent time from my PHP code? When you do a mysql
statement on a terminal this is shown at the end of the results, but i
can't find how to get this from PHP.


This will provide the _PHP_ execution time, but won't actually extract the MySQL
response that you mentioned. I'm curious if someone else can help on that
second, more accurate, result.

<?php
ereg("(\.[0-9]+) ([0-9]+)",microtime(),$time);
$starttime = doubleval($time[1])+doubleval($time[2]);
?>

[insert MySQL code here]

<?php
ereg("(\.[0-9]*) ([0-9]*)",microtime(),$time);
$endtime=doubleval($time[1])+doubleval($time[2]);
$runtime = number_format($endtime-$starttime,4)." Seconds";
echo "<!-- [$runtime] -->";
?>

Jul 20 '05 #2

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

Similar topics

1
by: Justo | last post by:
I would like to write the spent time for a mysql select, in the style of Google's searches: "x results found for xxxxxx in xx secs". How could i get the spent time from my PHP code? When you do a...
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...
10
by: fabio de francesco | last post by:
Hi what do you think of the following? Why are we permitted to do that? And why the C++ Library doesn't stop someone willing to perfom that assignement (*a = 20)? #include <iostream> ...
6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
38
by: vashwath | last post by:
Might be off topic but I don't know where to post this question.Hope some body clears my doubt. The coding standard of the project which I am working on say's not to use malloc.When I asked my...
5
by: v.anupama | last post by:
I have a requirement where a user can access ONLY one file at any given time out of a list of files listed in datagrid (button/hyperlink columns). Only files listed are pdf,doc,txt. I cannot use...
8
by: cyberbless | last post by:
I'm creating a basic page like the on below. Problem is evertime I refresh the page or spawn a "child window" out of the pre-existing browser the Session object is recreated with a new sessionID. ...
3
by: jm.suresh | last post by:
I am trying to measure the time the processor spends on some operation, and I want this measure to not depend on the current load of the machine. But doing the following prints different values...
19
by: xianwei | last post by:
#include <stdio.h> #include <stdlib.h> #include <time.h> int main ( int argc, char *argv ) { long i = 10000000L; clock_t start, end; double duration;
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.