473,805 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP profiler

I'm looking for a GPL licensed PHP profiler. The best thing around,
except the commercial goodies from NuSphere, seems to be Carl Taylor's
toolkit at http://www.adepteo.net/profiler/index.php
Any experiences? Does anybody here uses profiler to see where the
application time is spent and which components need fine tuning?

--
http://www.mgogala.com

Dec 17 '05 #1
6 2922
Here is a simple profiler I wrote. It uses a tick function to measure
the time expired between each PHP operation and debug_back_trac e() to
find out where it occurs. Kinda neat as you don't have to make much
modification. Just include it at the beginning of the script, then at
the end, call __profile__('ge t') to obtain the profile data--an
associative array of percentages keyed by function names.

profiler.php:
<?php

function __profiler__($c md = false) {
static $log, $last_time, $total;
list($usec, $sec) = explode(" ", microtime());
$now = (float) $usec + (float) $sec;
if($cmd) {
if($cmd == 'get') {
unregister_tick _function('__pr ofile__');
foreach($log as $function => $time) {
if($function != '__profile__') {
$by_function[$function] = round($time / $total * 100, 2);
}
}
arsort($by_func tion);
return $by_function;
}
else if($cmd == 'init') {
$last_time = $now;
return;
}
}
$delta = $now - $last_time;
$last_time = $now;
$trace = debug_backtrace ();
$caller = $trace[1]['function'];
@$log[$caller] += $delta;
$total += $delta;
}

__profiler__('i nit');
register_tick_f unction('__prof iler__');
declare(ticks=1 );

?>

Dec 18 '05 #2
Forgot to mention that as tick functions don't work in a threaded
environment, you'll need to set up PHP as CGI if you're on Windows.

Dec 18 '05 #3
Mladen Gogala wrote:
I'm looking for a GPL licensed PHP profiler. The best thing around,
except the commercial goodies from NuSphere, seems to be Carl Taylor's
toolkit at http://www.adepteo.net/profiler/index.php
Any experiences? Does anybody here uses profiler to see where the
application time is spent and which components need fine tuning?


Never tried. But, I use APD <http://in.php.net/apd>. It's neat, but
lacks GUI. We use our own GUI (can't give, sorry).

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Dec 20 '05 #4
Chung Leong wrote:
Here is a simple profiler I wrote.

<snip>

Hard core programmers like you'll always write codes and would
restrain to use other tools:( But, I would suggest you to try APD
<http://in.php.net/apd> and see the difference.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Dec 20 '05 #5
On Mon, 19 Dec 2005 20:51:10 -0800, R. Rajesh Jeba Anbiah wrote:
Never tried. But, I use APD <http://in.php.net/apd>. It's neat, but
lacks GUI. We use our own GUI (can't give, sorry).


APD is a debugger, not a profiler. Thanks.

--
http://www.mgogala.com

Dec 20 '05 #6
On Tue, 20 Dec 2005 15:55:50 GMT, Mladen Gogala <go****@sbcglob al.net> wrote:
On Mon, 19 Dec 2005 20:51:10 -0800, R. Rajesh Jeba Anbiah wrote:
Never tried. But, I use APD <http://in.php.net/apd>. It's neat, but
lacks GUI. We use our own GUI (can't give, sorry).


APD is a debugger, not a profiler. Thanks.


"APD is the Advanced PHP Debugger. It was written to provide profiling and
debugging capabilities for PHP code"

And it goes on with an example of profiling later on the page.

--
Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Dec 20 '05 #7

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

Similar topics

0
1887
by: Jeff Mair | last post by:
Hello all, I haven't been using profiler for a terribly long time, and I've come across something that I just can't figure out. I'm running MS Virtual PC to run a Win2K Server OS with SQL Server 2000 (sp3 i think). Whenever I start up SQL Profiler - even immediately after a bootup, if I try to pause, stop, or exit out of profiler, it hangs. The strange part is that it seems to keep on tracing even though it won't respond anymore. I...
8
2840
by: patrickshroads | last post by:
I am running a profiler trace against a database and noticed that the reads column always shows 0. When running the same trace against another machine I get back values in the reads column. I took a query that profiler reported as having 0 reads and ran in in query analyzer wtih STATISTICS IO on and confirmed that there are in fact reads: Table 'tt_cawardalloc'. Scan count 1, logical reads 8, physical reads 0, read-ahead reads 1. Table...
0
1658
by: DraguVaso | last post by:
Hi, I'm using for a while DevPartner Profiler (http://www.compuware.com/products/devpartner/resources/profiler/profiler.as p), but unfortunately it works only for 2002 and 2003. Is there a profiler that looks like DevPartner Profiler (gives the same information: shows clearly which methods/statements takes the most time in total etc and free!). Or will DevPartner make a version for 2005 soon?
9
3279
by: Franco Gustavo | last post by:
Hi, All What's is the best .net profiler for Debug an application. I have to buy one but I don't know which one!! I tried some of them like Borland and AQTime. My big problem is, my application is a big application, and many times I have many EventHandlers associated to an object, then this object never is free from the memory. AQTime for .Net can tell me how many references of EventHandler the object
3
1693
by: Maansi Gupta | last post by:
Platform - Windows 2000 Professional , VC .NET 7.1 Hello, I have recently ported my source code from Visual Studio 6.0 to .NET 7.1 Previously with Visual Studio 6.0 I was using the profiler in the following way 1) Build the project with link setting- Enable Profiling as checked. 2) I had created a custom batch file for profiling my application and was
8
2151
by: Bryan | last post by:
Does anyone have an example of an application that can connect to a running process and capture Trace.WriteLine calls like in SQL Server Profiler? I know that we can inherit from a TraceListener class to write to files, databases, etc..., but I would really like to attach to running .NET processes and get the results without any logging and instead capture the real-time results when troubleshooting.
1
3179
by: ofirmgr | last post by:
im trying to understand how the profiler works. so i started 2 profilers,one listen to another and I saw the profiler is running: exec sp_trace_create @P1 output, 1, NULL, NULL, NULL which means @tracefile = NULL so where from the profiler read the results?!
3
3686
by: Sam Samson | last post by:
Can any-one recommend some good sites detailing how to code a simple memory profiler? How do they "look under the hood"? I built an uber simple service that tracks the process' memory but I need to "get inside" and look a bit deeper and I don't have a clue where to start ... a commercial memory profiler is not an option due the nature of the environment the application is deployed in .. My app runs fine for weeks (in 8 locations) but...
2
2347
by: Paul Ritchie | last post by:
A few years ago I used a Profiler (I forget the name) on my Delphi code at the time and got fantastic results showing both: a) lines of code that took the longest to execute and b) lines of code that allocated the most unreleased memory. I have looked around and am unable to find a good tool to easily achieve these statistics for my C# Winforms application. Possible reasons are that: 1) I am having difficulty finding the existing...
0
5057
by: anweshadash | last post by:
Using SQL Profiler: (Ref: http://msdn2.microsoft.com/en-us/library/ms181091.aspx) Sometimes it’s very beneficial to use sql profiler. Let’s have an idea about that and how to use that by taking some scenarios. Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the SQL Server Database Engine or Analysis Services. You can capture and save data about each event to a file or table to...
0
9716
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5536
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
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
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.