Xhprof получить callgraph

По инструкции https://grandrr.medium.com/profiling-php-application-with-docker-and-xhprof-e23188bdc223

ENV XHPROF_VERSION=2.3.9
# install the xhprof extension to profile requests
RUN curl "http://pecl.php.net/get/xhprof-${XHPROF_VERSION}.tgz" -fsL -o ./xhprof-${XHPROF_VERSION}.tgz && \
    mkdir /var/xhprof && tar xf ./xhprof-${XHPROF_VERSION}.tgz -C /var/xhprof && \
    cd /var/xhprof/xhprof-${XHPROF_VERSION}/extension && \
    phpize && \
    ./configure && \
    make && \
    make install

# custom settings for xhprof
COPY ./xhprof.ini /usr/local/etc/php/conf.d/xhprof.ini

RUN docker-php-ext-enable xhprof

#folder for xhprof profiles (same as in file xhprof.ini)
RUN mkdir -m 777 /profiles

проект в докер

в проекте поставил "lox/xhprof": "dev-master"

php -v
PHP 7.4.30 (cli) (built: Sep 13 2022 11:11:11) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with the ionCube PHP Loader + ionCube24 v12.0.5, Copyright (c) 2002-2022, by ionCube Ltd.
    with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies
    with Xdebug v2.8.1, Copyright (c) 2002-2019, by Derick Rethans

сам код

xhprof_enable(XHPROF_FLAGS_MEMORY + XHPROF_FLAGS_CPU);

// some code


if (extension_loaded('uprofiler')) {
    $profiler = 'uprofiler';
}
elseif (extension_loaded('xhprof')) {
    $profiler = 'xhprof';
}
else {
    $profiler = NULL;
}
if ($profiler) {
    $enable = "{$profiler}_sample_enable";
    $disable = "{$profiler}_sample_disable";
    $uri = substr($_SERVER['REQUEST_URI'], 1);
    $uri = preg_replace('/[?\/]/', '-', $uri);
    $enable();
    register_shutdown_function(function () use($disable, $profiler, $uri) {
        $filename = __DIR__ . "/{$uri}." . uniqid() . ".{$profiler}";
        file_put_contents($filename, serialize($disable()));
        chmod($filename, 0777);
    });
}

получаю такое https://gist.github.com/des1roer/44c36b3d8f98c08b4d426285c2285708

затем использую https://github.com/setnemo/xhprof-php-docker-viewer

и получаю

введите сюда описание изображения

есть какие то возможности получить callgraph ?


Ответы (0 шт):