longxinH / xhprof

PHP7/PHP8 support
http://pecl.php.net/package/xhprof
Apache License 2.0
1.09k stars 167 forks source link

Use PHP 8.0 Observer API #56

Closed andypost closed 3 years ago

andypost commented 3 years ago

Attempt to use https://github.com/tideways/php-xhprof-extension/pull/96 to fix #51

andypost commented 3 years ago
PHP         : /usr/bin/php8 
PHP_SAPI    : cli
PHP_VERSION : 8.0.3
ZEND_VERSION: 4.0.3
PHP_OS      : Linux - Linux c4585ae91d4b 5.8.0-45-generic #51-Ubuntu SMP Fri Feb 19 13:24:51 UTC 2021 x86_64
INI actual  : /srv/tmp-php.ini
More .INIs  :   
CWD         : /srv
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2021-03-28 03:38:39
...
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   13
---------------------------------------------------------------------

Number of tests :   13                12
Tests skipped   :    1 (  7.7%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    5 ( 38.5%) ( 41.7%)
Tests passed    :    7 ( 53.8%) ( 58.3%)
---------------------------------------------------------------------
Time taken      :    3 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
XHProf: Basic Profiling Test
Author: Kannan [tests/xhprof_001.phpt]
XHProf: Test (direct and indirect) recursive function calls.
Author: Kannan [tests/xhprof_002.phpt]
XHProf: Test Class Methods, Constructors, Destructors.
Author: Kannan [tests/xhprof_003.phpt]
XHProf: Test excluding call_user_func and similar functions
Author: mpal [tests/xhprof_007.phpt]
XHProf: Sampling Mode Test
Author: kannan [tests/xhprof_008.phpt]
andypost commented 3 years ago

will reread https://www.datadoghq.com/blog/engineering/php-8-observability-baked-right-in/

meantime most of tests has more then needed lines logged

andypost commented 3 years ago
TEST 1/1 [tests/xhprof_002.phpt]
========DIFF========
002+ ct==>ct@1                               : ct=       1; wt=*;
003+ ct@1==>ct@2                             : ct=       1; wt=*;
     foo==>foo@1                             : ct=       1; wt=*;
     foo@1==>foo@2                           : ct=       1; wt=*;
004+ ct@2==>ct@3                             : ct=       1; wt=*;
002- foo==>foo@1                             : ct=       1; wt=*;
003- foo@1==>foo@2                           : ct=       1; wt=*;
004- foo@2==>foo@3                           : ct=       1; wt=*;
     foo@3==>foo@4                           : ct=       1; wt=*;
     main()                                  : ct=       1; wt=*;
007+ main()==>ct                             : ct=       1; wt=*;
007- main()==>foo                            : ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;

     Indirect Recursion
011+ ct==>ct                                 : ct=       1; wt=*;
012+ ct==>ct@1                               : ct=       1; wt=*;
013+ ct@1==>ct@2                             : ct=       1; wt=*;
014+ ct@2==>ct@3                             : ct=       1; wt=*;
015+ ct@3==>ct@4                             : ct=       1; wt=*;
016+ ct@4==>ct@5                             : ct=       1; wt=*;
017+ ct@5==>ct@6                             : ct=       1; wt=*;
018+ foo@6==>foo@7                           : ct=       1; wt=*;
019+ main()                                  : ct=       1; wt=*;
     foo@2==>bar@2                           : ct=       1; wt=*;
     foo@3==>bar@3                           : ct=       1; wt=*;
     main()                                  : ct=       1; wt=*;
020+ main()==>ct                             : ct=       1; wt=*;
011- bar==>foo@1                             : ct=       1; wt=*;
012- bar@1==>foo@2                           : ct=       1; wt=*;
013- bar@2==>foo@3                           : ct=       1; wt=*;
014- bar@3==>foo@4                           : ct=       1; wt=*;
015- foo==>bar                               : ct=       1; wt=*;
016- foo@1==>bar@1                           : ct=       1; wt=*;
017- foo@2==>bar@2                           : ct=       1; wt=*;
018- foo@3==>bar@3                           : ct=       1; wt=*;
019- main()                                  : ct=       1; wt=*;
020- main()==>foo                            : ct=       1; wt=*;
     main()==>xhprof_disable                 : ct=       1; wt=*;
========DONE========
FAIL XHProf: Test (direct and indirect) recursive function calls.

still can't make it pass, looks more then needed information is stored

longxinH commented 3 years ago

@andypost This problem will be fixed in the near future, thank you very much.

andypost commented 3 years ago

Much cleaner implementation landed, thank you @longxinH in https://github.com/longxinH/xhprof/commit/f5149a7c647112d2eba69f55483cf41aae88dac6