2013-06-20 17 views

cevap

0

Sadece apache php.ini değil, xdebug satırlarını cli php.ini dosyanıza eklediğinizden emin olun. Ubuntu'da /etc/php5/cli/php.ini adresinde. Sen dosyaya şu satırları eklemek gerekir: zend_extension =/usr/lib/php5/20100525 + lfs/xdebug.so xdebug.profiler_enable = 1 xdebug.profiler_output_dir =/path/to/OUTPUT_DIR xdebug.profiler_output_name = cachegrind.out% R.% t

DÜZENLEME:. Hata, ben cachegrind kullanmanın doğru düşünüyordum edilir. Eklenecek satırlar aşağıda olacak, ancak ana noktam aynı. Cli php.ini'ye bir göz attığınızdan emin olun.

[xhprof] 
extension=xhprof.so 
xhprof.output_dir="/var/tmp/xhprof" 
+1

soru xhprof ilgiliydi, bu XHProf.php alıyorsanız xdebug –

10

testi yavaş çalışan öğrenmek için, https://github.com/johnkary/phpunit-speedtrap

  • kullanmak Besteci yoluyla Dinleyici yükleyin ve sonra phpunit.xml, ör etkinleştirebilirsiniz

    <phpunit bootstrap="vendor/autoload.php"> 
    ... 
        <listeners> 
         <listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" /> 
        </listeners> 
    </phpunit> 
    

    testler yavaş çalışan, neden

    Sen phpunit.xml, ör yapılandırabilirsiniz kullanabilirsiniz öğrenmek için xhprof ilgili Gordon'un cevap @ desteklemek ciddi

    <listeners> 
        <listener class="PHPUnit_Util_Log_XHProf" file="PHPUnit/Util/Log/XHProf.php"> 
        <arguments> 
        <array> 
        <element key="xhprofLibFile"> 
         <string>/var/www/xhprof_lib/utils/xhprof_lib.php</string> 
        </element> 
        <element key="xhprofRunsFile"> 
         <string>/var/www/xhprof_lib/utils/xhprof_runs.php</string> 
        </element> 
        <element key="xhprofWeb"> 
         <string>http://localhost/xhprof_html/index.php</string> 
        </element> 
        <element key="appNamespace"> 
         <string>Doctrine2</string> 
        </element> 
        <element key="xhprofFlags"> 
         <string>XHPROF_FLAGS_CPU,XHPROF_FLAGS_MEMORY</string> 
        </element> 
        <element key="xhprofIgnore"> 
         <string>call_user_func,call_user_func_array</string> 
        </element> 
        </array> 
        </arguments> 
        </listener> 
    </listeners> 
    
+0

olduğunu dosya? Ve xhprof_lib dizinindeki dosyaya ne dersiniz? –

+0

[XHProf.php] (https://github.com/phpunit/phpunit-testlistener-xhprof). [xhprof_lib.php ve arkadaşlar] (https://github.com/phacility/xhprof). – bishop

3

.

  1. PECL extension
  2. user-space viewer

PECL eklentisi ölçümlerini toplama PHP motoruna yöntemler ekler:

iki bölüm vardır. Bu uzantıyı yüklemelisiniz.

Kullanıcı alanı görüntüleyicisi, metrik koleksiyonunun çıktısını anlamak için bir web arayüzü sağlar. Bu 'u'a ihtiyaç duymazsınız, ancak siz gerçekten 'u istersiniz. Ham metrik verilere bakmaktan hoşlanmıyorsanız.PHPUnit Testlerinin profil böylece yüklemek ve kullanıcı uzay görüntüleyici yapılandırmak için:

(1) için bu paketleri ekleyin senin composer.json:

composer require "facebook/xhprof:[email protected]" --dev 
composer require "phpunit/test-listener-xhprof:1.0.*@dev" --dev 

(2) satıcıyı hizmet etmek web sunucusu yapılandırma/facebook/xhprof/xhprof_html/dizin. URL'yi hatırla.

(3) Mevcut PHPUnit yapılandırmanızı buna benzer bir phpunit-xhprof.xml içine yerleştirin.

<phpunit> 
    <testsuites> 
    <testsuite name="All Tests"> 
     <directory suffix="Test.php">tests/</directory> 
    </testsuite> 
    </testsuites> 
    <listeners> 
    <listener class="PHPUnit\XHProfTestListener\XHProfTestListener" file="vendor/phpunit/test-listener-xhprof/src/XHProfTestListener.php"> 
    <arguments> 
     <array> 
     <element key="appNamespace"> 
     <string>App</string> 
     </element> 
     <element key="xhprofWeb"> 
     <string>http://localhost/vendor/facebook/xhprof/xhprof_html/index.php</string> 
     </element> 
     <element key="xhprofLibFile"> 
     <string>./vendor/facebook/xhprof/xhprof_lib/utils/xhprof_lib.php</string> 
     </element> 
     <element key="xhprofRunsFile"> 
     <string>./vendor/facebook/xhprof/xhprof_lib/utils/xhprof_runs.php</string> 
     </element> 
     <element key="xhprofFlags"> 
     <string>XHPROF_FLAGS_CPU,XHPROF_FLAGS_MEMORY</string> 
     </element> 
     <element key="xhprofIgnore"> 
     <string>call_user_func,call_user_func_array</string> 
     </element> 
     </array> 
    </arguments> 
    </listener> 
    </listeners> 
</phpunit> 

(4) Run PHP ve istatistik toplamak: phpunit -c ./phpunit-xhprof.xml

Sen çıktıyı görürsünüz siz "appNamespace" 2. adımdaki URL'ye kodunuzu ve değişim "xhprofWeb" eşleşecek şekilde değiştirmek emin olun benzer:

* BishopB\Pattern\Exception\InvalidArgumentTest::test_hierarchy 
    http://localhost/vendor/facebook/xhprof/xhprof_html/index.php?run=556e05cec844c&source=BishopB\Pattern 

Çalıştırdığınız sonucu görüntülemek için yapılandırdığınız URL budur. Eğer ham ölçülerine veriler görüntülemek isterseniz, geçici dizinde (bu örnekte "556e05cec844c",) çalışıyorsa anahtarını bulun:

$ ls -l /tmp/556e05cec844c.BishopB\\Pattern.xhprof 
-rw-rw-r-- 1 bishop staff 16963 Jun 2 15:36 /tmp/556e05cec844c.BishopB\Pattern.xhprof 
İlgili konular