3 | | Soon. Meanwhile code is available: source:/phptop/ |
| 3 | [[PageOutline]] |
| 4 | |
| 5 | == Summary == |
| 6 | |
| 7 | * '''Licence''': GPL v3 |
| 8 | * '''Source''': |
| 9 | * Download attachment:phptop-0.1.tar.gz |
| 10 | * Checkout with {{{svn co svn://forge.bearstech.com/forge/phptop}}} |
| 11 | * Browse at source:/phptop/ |
| 12 | |
| 13 | '''phptop''' prints per query and average metrics comparable to the 'time' program or shell builtin: wallclock, user and system CPU time along with memory and other ressource usages. |
| 14 | |
| 15 | |
| 16 | == Installation == |
| 17 | |
| 18 | It can be easily globally activated on a LAMP server and requires little ressources and a single line configuration change in your php.ini. For instance: |
| 19 | {{{ |
| 20 | server:~# echo auto_prepend_file=/path/to/phptop_hook.php >/etc/php/php.ini |
| 21 | server:~# apache2ctl reload |
| 22 | }}} |
| 23 | |
| 24 | Wait a few minutes to collect enough data then run '''phptop'''. |
| 25 | |
| 26 | |
| 27 | == Usage == |
| 28 | |
| 29 | On a server with several distinct vhost and applications, anlyzing last 15 minutes and sorting by average memory usage per query: |
| 30 | {{{ |
| 31 | server:~$ phptop -t 15 -s mem |
| 32 | Hit Time User Sys Mem/hit Mem_max Inc/hit Inc_max |
| 33 | http://foo.org/node/88 5 0.3 0.2 0.0 4.3 21.5 15 78 |
| 34 | http://bar.org/sv/cities 5 1.2 0.2 0.1 4.9 24.5 25 125 |
| 35 | http://foo.org/homepage/feed 15 0.7 0.5 0.1 4.2 21.2 14 74 |
| 36 | http://bip.net/2007/08/24/ 5 0.6 0.2 0.0 2.9 14.2 14 71 |
| 37 | http://bip.net/feed/atom/ 5 0.1 0.1 0.0 2.8 14.0 11 58 |
| 38 | http://baz.com/tag/megaloop/ 5 0.2 0.1 0.0 2.4 12.0 11 56 |
| 39 | http://bip.net/ 10 0.7 0.4 0.1 2.9 14.2 14 70 |
| 40 | http://baz.com/spots/ 5 1.2 0.0 0.0 1.6 7.8 16 84 |
| 41 | http://baz.com/tag/international/ 5 0.2 0.1 0.0 2.4 11.8 11 56 |
| 42 | http://baz.com/ 10 0.4 0.3 0.1 2.4 12.0 11 56 |
| 43 | |
| 44 | Total 140 6.4 2.6 0.5 |
| 45 | }}} |
| 46 | |
| 47 | Once the 'recorder hook' is installed, running '''phptop''' does not need other privileges besides read access to the relevant log files. |