hi there,
do anyone know a good php script performance tester? (free..)
thankyou
regards.
9 2317
I was thinking about how to speed test a php script, and I'm not sure.
I get the basics:
testing the first action -
$i = 0;
-
while($i < 10000){
-
//do action 1
-
}
-
//return time
-
testing the second action -
$i = 0;
-
while($i < 10000){
-
//do action 2
-
}
-
//return time
-
...hmmm...would getting the system time in microseconds at the beginning and end, and getting the difference work? sorry, but I just thought of that. I'll get back in a sec with confirmation or lack thereof.
Found the anser at php manual.
Here is the code for testing time in microseconds: -
<?php
-
/**
-
* Simple function to replicate PHP 5 behaviour
-
*/
-
function microtime_float()
-
{
-
list($usec, $sec) = explode(" ", microtime());
-
return ((float)$usec + (float)$sec);
-
}
-
-
$time_start = microtime_float();
-
-
// Sleep for a while
-
usleep(100);
-
-
$time_end = microtime_float();
-
$time = $time_end - $time_start;
-
-
echo "Did nothing in $time seconds\n";
-
?>
-
so the usleep() would be replaced by the script to test?
Nice thanks!
Yeah, you will need microtime() function, which returns a float anyway.
As much as the script above probably works, really all you need to do is have something like: - $timer = explode( ' ', microtime() );
-
$start = $timer[1] + $timer[0];
-
-
***Your Code***
-
-
$timer = explode( ' ', microtime() );
-
echo( ($timer[1] + $timer[0])-$start );
-
Thanks for the information. I had tried using date('u') initially, but that only returned all 0's.
No worries. I did the same thing when I tried to make one last year before I was told about microtime().
Threads merged. Basically the same topic :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tom Verbeure |
last post by:
Hello All,
so I'm now convinced that unit testing is really the way to go and I
want to add it to an existing project. The first thing that I find
out, is that, well, it's hard work. Harder than...
|
by: William Kossack |
last post by:
We have developed a web based database app but now we have discovered
the need to do functional testing.
We don't need performance or benchmarking
We don't want to spend too much time coding...
|
by: Curtis Justus |
last post by:
Hi,
I've been searching for solutions to two issues that are undoubtedly common
to everybody. The first is how do my team and I adequately perform unit
testing. The second is how can I measure...
|
by: Pablo Cedeno |
last post by:
Hi all,
I'm looking for a testing tool to test my web application made in aspx
I started working with JMeter but i'm lost in this. I made the simpliest
test, get an aspx page, but now i need to...
|
by: yoni |
last post by:
Hi All,
I have a complex C# application (winforms) that I am taking over. I do
maintenance and add small features here and there. what I need is:
1. a tool that will help with testing. that is,...
|
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= |
last post by:
Hi,
I know that VS 2005 has a lot of testing features and already used them for
doing web load testing.
I am wondering if it is possible to load test a win forms application. I
don't mean writing...
|
by: =?ISO-8859-1?Q?Fad=A5?= |
last post by:
Hello guys,
I want to do kinda of an A/B split testing on a website I run. I just
created a new version but I need to keep both version running and see
which one will perform better. First, I'm...
|
by: MacRules |
last post by:
Found this testing tool,
http://simpletest.sourceforge.net/
I am looking for PHP scripts which can be used as create many
connections to a web server or MySQL back end for stress testing.
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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...
| |