NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
The PhpED Profiler is lacking


Joined: 23 Jun 2006
Posts: 14
Reply with quote
Hi,

Nice going on 4.6 but I think the profiler needs a lot more work.

I think is needs to allow a developeer to view calling stack in a tree-view like manner with time taken.

Show more details about who's calling and such.

A pie chart view would also be nice
View user's profileFind all posts by xwisdomSend private message


Joined: 14 Jun 2006
Posts: 14
Location: Eindhoven, Netherlands
Reply with quote
That would certainly be nice. Smile Especially the tree-view with backtrace!
View user's profileFind all posts by MeAngrySend private messageVisit poster's websiteMSN Messenger


Joined: 02 Aug 2006
Posts: 7
Reply with quote
APD does this.

After installing APD, just put this statement at the top of your file.

apd_set_pprof_trace();

Then, run your page. It will produce a profiling trace file in whatever path you set in your INI. (For my INI, i had to enable extension=php_apd.dll and set some other arguments at the bottom. See these links for help: http://pecl.php.net/package/apd, )

Then, on the command line run this command:

php.exe -f pprofp.php -- -t -i -R apd_trace\pprof.0935.023948502395 > apd_trace\prof.txt

That's assuming that 'apd_trace' is your output and 'pprof.0935.023948502395' is your most recent profile.

The result you get is exactly what you want. The -R option tells you the total cumulative time spent in each function. Here is some sample output, both before and after my optimization. Notice that the total time went from 6.95 seconds to 2.94 seconds, all because I optimized my config_get() function.

The rest of the output (not included here) shows the whole call stack, nicely indented so you can see what function calls what other functions.


Code:


--- BEFORE MY OPTIMIZATION ---

         Real         User        System             secs/    cumm
%Time (excl/cumm)  (excl/cumm)  (excl/cumm) Calls    call    s/call  Memory Usage Name
--------------------------------------------------------------------------------------
100.0 0.00 6.95  0.00 5.91  0.00 0.61     1  0.0022   6.9539            0 main
96.7 1.87 6.72  1.70 5.92  0.13 0.44  5225  0.0004   0.0013            0 config_get
72.7 0.00 5.05  0.00 4.48  0.00 0.39     3  0.0009   1.6845            0 include
61.3 0.00 4.26  0.00 3.78  0.00 0.34     1  0.0009   4.2640            0 write_bug_rows
59.2 0.03 4.12  0.02 3.69  0.00 0.33   284  0.0001   0.0145            0 helper_call_custom_function
56.3 0.04 3.91  0.05 3.47  0.02 0.33   264  0.0002   0.0148            0 custom_function_default_print_column_value
39.7 0.49 2.76  0.36 2.27  0.11 0.42    56  0.0087   0.0492            0 require_once
35.7 0.05 2.48  0.05 2.20  0.02 0.17  2538  0.0000   0.0010            0 auth_is_user_authenticated
33.7 0.05 2.34  0.06 2.13  0.00 0.14   583  0.0001   0.0040            0 helper_get_current_project
32.4 0.05 2.25  0.05 2.00  0.03 0.16  2539  0.0000   0.0009            0 auth_get_current_user_cookie
27.8 0.01 1.93  0.00 1.80  0.00 0.16   670  0.0000   0.0029            0 access_has_project_level
26.0 0.02 1.81  0.00 1.61  0.00 0.16   653  0.0000   0.0028            0 access_get_project_level
22.8 0.25 1.59  0.19 1.31  0.05 0.13  10991  0.0000   0.0001            0 config_get_global
19.2 1.30 1.33  1.11 1.13  0.08 0.08  10990  0.0001   0.0001            0 config_eval
16.6 0.01 1.15  0.00 1.09  0.00 0.09   656  0.0000   0.0018            0 access_get_global_level
13.3 0.00 0.93  0.00 0.91  0.00 0.05    22  0.0000   0.0421            0 print_column_edit
13.2 0.00 0.92  0.00 0.81  0.00 0.11    22  0.0001   0.0418            0 print_column_status
11.3 0.00 0.79  0.00 0.56  0.00 0.06     1  0.0000   0.7860            0 html_page_top2
10.2 0.00 0.71  0.00 0.59  0.00 0.05    57  0.0000   0.0125            0 access_has_bug_level
9.3 0.00 0.65  0.00 0.44  0.00 0.05     1  0.0011   0.6498            0 html_login_info

------AFTER MY 2-LINE OPTIMIZATION----

         Real         User        System             secs/    cumm
%Time (excl/cumm)  (excl/cumm)  (excl/cumm) Calls    call    s/call  Memory Usage Name
--------------------------------------------------------------------------------------
100.0 0.00 2.94  0.00 2.28  0.00 0.36     1  0.0012   2.9416            0 main
95.6 0.51 2.81  0.38 2.17  0.14 0.59    56  0.0091   0.0502            0 require_once
48.2 0.00 1.42  0.00 1.16  0.00 0.19     3  0.0010   0.4721            0 include
38.3 0.00 1.13  0.00 0.94  0.00 0.13     1  0.0010   1.1275            0 write_bug_rows
38.3 0.03 1.13  0.00 0.94  0.02 0.13   284  0.0001   0.0040            0 helper_call_custom_function
36.5 0.04 1.07  0.09 0.91  0.03 0.11   264  0.0002   0.0041            0 custom_function_default_print_column_value
24.5 0.44 0.72  0.27 0.59  0.03 0.05  2357  0.0002   0.0003            0 config_get
16.9 0.00 0.50  0.00 0.33  0.00 0.00     1  0.0000   0.4981            0 html_page_top2
15.1 0.01 0.44  0.00 0.17  0.00 0.03   102  0.0001   0.0044            0 db_query
14.2 0.00 0.42  0.00 0.25  0.00 0.00     1  0.0009   0.4185            0 html_login_info
13.5 0.00 0.40  0.00 0.16  0.00 0.02   103  0.0000   0.0039            0 ADODB_mysql->Execute
13.4 0.01 0.39  0.02 0.16  0.00 0.02   103  0.0001   0.0038            0 ADODB_mysql->_Execute
11.7 0.17 0.34  0.14 0.22  0.00 0.03   570  0.0003   0.0006            0 error_handler
11.6 0.01 0.34  0.05 0.38  0.00 0.05   626  0.0000   0.0005            0 auth_is_user_authenticated
11.4 0.33 0.33  0.08 0.08  0.02 0.02   103  0.0032   0.0032            0 ADODB_mysql->_query
9.5 0.01 0.28  0.00 0.28  0.02 0.05   627  0.0000   0.0004            0 auth_get_current_user_cookie
9.4 0.00 0.28  0.00 0.27  0.00 0.03   192  0.0000   0.0014            0 access_has_project_level
8.3 0.00 0.24  0.00 0.20  0.00 0.00    91  0.0000   0.0027            0 string_display
8.1 0.00 0.24  0.00 0.23  0.00 0.03   175  0.0000   0.0014            0 access_get_project_level
7.5 0.01 0.22  0.03 0.22  0.00 0.03   105  0.0001   0.0021            0 helper_get_current_project


View user's profileFind all posts by benlesSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8350
Reply with quote
I'm working in php4 and APD crashes it, approx one of 5-8 requests are dumping core.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 02 Aug 2006
Posts: 7
Reply with quote
I've only tested on PHP5, sorry Sad
View user's profileFind all posts by benlesSend private message
The PhpED Profiler is lacking
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic