473,322 Members | 1,347 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,322 software developers and data experts.

Benchmark tool

code green
1,726 Expert 1GB
Anybody recommend a reliable benchmark tool for PHP.
I have been using Timer.php which is an old PEAR class, but I am discovering it's accuracy is very poor.

A simple class that tells the truth is all I need
Aug 17 '10 #1
5 1566
HaLo2FrEeEk
404 256MB
What do you need to benchmark? How long a specific task takes to execute? Resources used? When I need to know how long a task takes I simply create a time_start and time_end variable using this:

array_sum(explode(' ', microtime()));

Then subtract the start from the end and round the result to whatever depth you want. I usually show two decimal places. Full code:

Expand|Select|Wrap|Line Numbers
  1. $t_start = array_sum(explode(' ', microtime()));
  2.  
  3. // Some code
  4.  
  5. $exectime = round(array_sum(explode(' ', microtime())) - $t_start, 4);
  6. echo "Execution time: " . $exectime;
Will give you the time it took to process "some code" to a precision of 4 decimal places. Works well for me.

Hopefully this is somewhat close to what you were looking for.
Aug 17 '10 #2
code green
1,726 Expert 1GB
It would be hard work to copy a paste 2-3 lines of code all over the place in some of the huge projects I use.
At the moment I use one line as a marker
$t->setMarker('Flag Name'), and the results are output tidily at the end of execution in a table, rather than buried amongst all the other debugging output.

But Timer.php tells lies. Especially early in the execution where the time can be applied to the wrong marker.

I am just wondering if any has used anything better.
If not I will have to write my own.
Aug 18 '10 #3
Dormilich
8,658 Expert Mod 8TB
I use XDebug in combination with a cache grinder.
Aug 20 '10 #4
code green
1,726 Expert 1GB
I use XDebug in combination with a cache grinder.
That sounds complicated although I have no idea what they are :)

The performance I am measuring are purely database and function / class calls directly on a server.
There is no parsing of web pages or server connection issues (maybe a little, but only on intranet).
For example a script this morning took ~2 minutes in total to run.
The longest section was 48 seconds for a MsSQL query.

I need to identify this type of thing.
Aug 20 '10 #5
Dormilich
8,658 Expert Mod 8TB
XDebug is a PHP extension which provides debugging and profiling capabilities.

a cache grinder is a tool to make profiling information visible (cf. KCacheGrind, webcachegrind and the additional info at XDebug)
Aug 20 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

44
by: Carl | last post by:
"Nine Language Performance Round-up: Benchmarking Math & File I/O" http://www.osnews.com/story.php?news_id=5602 I think this is an unfair comparison! I wouldn't dream of developing a numerical...
0
by: julio | last post by:
Hello Guys, AlphaServer EV6 processor 500mhz/1Gm memory with Linux mysql> SELECT BENCHMARK(1000000,ENCODE("hello","goodbye")); +----------------------------------------------+ |...
3
by: Steve | last post by:
Hi, I'm currently looking a porting our Windows Codewarrior based C++ projects to MinGW and/or Visual Studio and I'm just wondering if there is a 'standard' suite of benchmark programs I can...
4
by: prabu | last post by:
i am looking for a tool which could simulate many transactions to the database, thus stressing the database. Also I am looking for a performance monitor tool for database. Please let me know if...
2
by: Matthijs van Waveren | last post by:
"Your opportunity to be a RECOGNIZED EXPERT in the HPC Community" The SPEC High Performance Group is seeking candidates for a benchmark suite based on Message Passing Interface (MPI)...
7
by: Ralph Mason | last post by:
I was looking at this page http://www.garret.ru/~knizhnik/dybase/doc/dybase.html And noticed running the same code (Java ported to C# using the MS tool I expect) that the C# implementation is...
7
by: ab3331 | last post by:
I need a tool that acts like a browser, but instead of actually rendering a page, it explains in English exactly what rules it's interpreting. This would make it simple to see which rules are...
4
by: FFMG | last post by:
Hi, I want to stress test my dev box to see where the bottle necks in my script might be. I don't really need to test MySQL or Apache, (I have no doubt they are working fine), but rather want...
1
by: Hans Mull | last post by:
Hi! I've created a benchmark tool which uses Agner Fog's asmlib to count the clockcycles a function takes. I 'm using it to measure the MersenneTwister.h speed. Sourcecode is here:...
37
by: Jack | last post by:
I know one benchmark doesn't mean much but it's still disappointing to see Python as one of the slowest languages in the test: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.