Coder Social home page Coder Social logo

php-profiler's People

Contributors

4513 avatar dmitryuk avatar glensc avatar krinkle avatar markstory avatar ossinkine avatar quazz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

php-profiler's Issues

Change default branch to `main`

The reason is simple, I've already used to switching to branch main.

This will give also out impression to other developers that the project is modern and actively maintained ;)

ArrayAcces implementation PHP 8.1 Compatibility

Currently https://github.com/perftools/php-profiler/blob/main/src/Config.php will throw deprecation notices because any implementation of ArrayAccess needs to have the methods compatible.

PHP Deprecated: Return type of Xhgui\Profiler\Config::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

as an example, but all the offset functions are affected.

So as it says; either the return type must be defined or it must be noted that the return type will change

Release 1.0.0 stable api

  • make collector configurable, currently, the user can't pick a specific one: #18
  • make saver configurable. currently, the user can't pick a specific one
  • add token to upload saver: #17
  • make pdo, mongodb dependencies optional
  • detach from xhgui-collector package

Set ProfilingId from Profiler?

In mongo saver there's getLastProfilingId method:

that has a side-effect, that if this saver is called in the application side, the id would be re-used for multiple profilings.

I don't know if that's deliberate or not, but using other savers this functionality is not present.

Question:

  • should the id be generated on the profiler side or xhgui side?

Having it profiler side could overwrite (accidentally or deliberately) existing profiling. I don't think saving the same id twice will merge the results?

Having it set at the profiler side, allows the profiler to control the id value.

and if reading the importer section:

it says importing the same profile twice creates duplicate profiling, so the duplicate id sent from profiler is not overwriting other profilers? is there any point then having value re-used? set from profiler?

cc @perftools/maintainers

Provide preload.php to support PHP 7.4 / vendor profiling

When using XHProf as composer package it is available after loading vendor/autoload.php .
This makes it impossible to measure the impact of vendor-loading itself
and also PHP 7.4 preloading can not be used in any way.
Creating a preload.php with essential classes could solve the problem.

Example:

When writing a package that has some file loaded via composer

{
  "files": [
      "foo.php"
    ],
}

then XHProf needs to be available before Composers autoload.php to measure its impact.
By now this can be done manually:

require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profilers/ProfilerInterface.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profilers/AbstractProfiler.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profilers/XHProf.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profilers/UProfiler.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profilers/TidewaysXHProf.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profilers/Tideways.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/SaverFactory.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Saver/SaverInterface.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Saver/UploadSaver.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/ProfilerFactory.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/ProfilingFlags.php';
require_once __DIR__ . '/../vendor/perftools/php-profiler/src/Profiler.php';

(new \Xhgui\Profiler\Profiler( /* ... */ ))->start();

require_once __DIR__ . '/../vendor/autoload.php';

But it would be nice to have a preload.php in this repo ( https://github.com/perftools/php-profiler ) that loads all classes to allow measuring of vendor autoloads.

Exclude all ENV

Hi, @glensc , first of all thank you for supporting this package <3

In my project i need to exclude all $_ENV, there is few thousands of secrets.
Actualy this meta.env not used in xhgui UI.

Can we add some flag to not export this envs in ProfilingData::getProfilingData ?
Like profiler.exclude-all-env: bool ?
Or maybe check profiler.exclude-env is true - exclude all instead of list?

I can make PR.

cumulative counts are off

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'],
            ),
        ]);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.