Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cumulative counts are off #78

Open
dadamssg opened this issue Oct 20, 2022 · 1 comment
Open

cumulative counts are off #78

dadamssg opened this issue Oct 20, 2022 · 1 comment

Comments

@dadamssg
Copy link

dadamssg commented Oct 20, 2022

I'm running this within a php 8.1 alpine docker image and noticed that the cumulative counts are way off.

image

I'm using the Profiler::PROFILER_TIDEWAYS_XHPROF profiler.

        $builtIns = (int) ($_GET['xhprof_builtins'] ?? 0);

        $flags = [
            ProfilingFlags::CPU,
            ProfilingFlags::MEMORY,
            ProfilingFlags::NO_SPANS,
            ProfilingFlags::NO_BUILTINS
        ];

        if ($builtIns === 1) {
            unset($flags[3]);
        }

        $profiler = new \Xhgui\Profiler\Profiler([
            'profiler' => Profiler::PROFILER_TIDEWAYS_XHPROF,
            'profiler.enable' => function () {
                $queryToken = $_ENV['XHPROF_QUERY_TOKEN'] ?? null;
                $incomingToken = $_GET['xhprof'] ?? null;
                return !empty($queryToken) && $incomingToken === $queryToken;
            },
            'profiler.flags' => $flags,
            'save.handler' => \Xhgui\Profiler\Profiler::SAVER_UPLOAD,
            'save.handler.upload' => array(
                'url' => $_ENV['XHGUI_HOST'] . '/run/import',
                'timeout' => 3,
                'token' => $_ENV['XHGUI_UPLOAD_TOKEN'],
            ),
        ]);
@glensc
Copy link
Contributor

glensc commented Oct 20, 2022

https://github.com/perftools/php-profiler is just a helper to capture profiling data from the extension, encapsulate and send it to xhgui.

your problem is either in the profiler:

or the GUI:

You should probably use the FILE saver to save data from the extension to json and check if the json is incorrect:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants