Re: profiling extension and minimal-php-sapi
| From: | Antony Dovgal | Date: | Sat, 20 May 2006 21:55:47 +0000 |
| Subject: | Re: profiling extension and minimal-php-sapi | ||
| References: | 1 | Groups: | php.internals php.pecl.dev |
| Request: | Send a blank email to internals+get-23594@lists.php.net to get a copy of this message | ||
You need to contact pecl-dev@lists.php.net to apply for PECL account.
I CC'ed this list.
On 21.05.2006 01:16, Moritz Möller wrote:
Hello, I made two extensions for PHP that I’m want to share, but I do not really know how to do it ;)Basically you've already done (almost) everything. You also need to clarify which license you're going to use for those extensions (from what I can see it's PHP License and it's fine).
One is a profiling extension, called PhProfile:Personally, I like the idea of this one. But there are several things I'd like to change: 1) I don't see any sense in these INI options. I think it's pretty easy to add if (isset($_REQUEST['profiler_or_anything you like'])) profiler_start(); And having an extension that uses popups (which every browser blocks nowadays) is not really good idea too IMO. Both Javascript and HTML do not look really good in console.. 2) I don't like the name =). IMO "profiler" is enough. This applies to functions too, of course. I didn't look into the implementation too close, but there are several problems I've spotted: 1) Did you try to run phprofiler_get() before phprofiler_start()? You should get a segfault, because PHPROFILER_G(data) is not initialized at this point. Btw, there is profiler_start(), but no profiler_end/stop()? 2) You need to make the code to comply with PECL coding standards if you want it to be accepted. Windows EOLs, one-line IF's are no good.. 3) This code won't compile with MSVC and gcc 2.9x: static void phprofiler_zend_execute_internal(zend_execute_data* execute_data_ptr, int return_value_used TSRMLS_DC) { if (!PHPROFILER_G(enabled)) {- works with zend optimizer and similar (as opposed to xdebug)- counts the number of function calls and the total send self timefor each function- usable either by calling phprofile_start(); at the beginning andprint_r(phprofile_get()) at the end of the script or- by setting up a “dump-profile” parameter in your php.ini (likephprofile.quick_dump_key=”prof”) and appending the parameter prof to the url (script.php?prof=1). If done, a html table with all function calls sorted by self time is appended to the page.- If phprofile.quick_dump_mode is set to “2”, the profiling data isdisplayed in a popup
phprofiler_saved_zend_execute_internal(execute_data_ptr, return_value_used TSRMLS_CC);
return;
}
const char* function_name = execute_data_ptr->function_state.function->common.function_name;
...
}
You have to move "const char*" declaration to the beginning to of the func.
--
Wbr,
Antony Dovgal