Issues (200)

src/Command/Converter/FlameGraphCommand.php (5 issues)

Labels
Severity
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Command\Converter;
15
16
use Noodlehaus\Config;
0 ignored issues
show
The type Noodlehaus\Config was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use PhpCast\Cast;
0 ignored issues
show
The type PhpCast\Cast was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
The type Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
final class FlameGraphCommand extends Command
23
{
24
    public function __construct(
25
        private Config $config,
26
    ) {
27
        parent::__construct();
28
    }
29
30
    public function configure(): void
31
    {
32
        $this->setName('converter:flamegraph')
33
            ->setDescription('convert phpspy-compatible trace file to flamegraph')
34
        ;
35
    }
36
37
    public function execute(InputInterface $input, OutputInterface $output): int
38
    {
39
        $tools_path = Cast::toString($this->config->get('paths.tools'));
40
41
        $flamegraph = "{$tools_path}/flamegraph/flamegraph.pl";
42
        $stackcollapse = "{$tools_path}/stackcollapse-phpspy/stackcollapse-phpspy.pl";
43
44
        $stackcollapse_process = proc_open(
45
            [
46
                $stackcollapse,
47
            ],
48
            [
49
                0 => STDIN,
50
                1 => ['pipe', 'w'],
51
                2 => STDERR,
52
            ],
53
            $stackcollapse_pipes
54
        );
55
        $flamegraph_process = proc_open(
56
            [
57
                $flamegraph,
58
            ],
59
            [
60
                0 => $stackcollapse_pipes[1],
61
                1 => STDOUT,
62
                2 => STDERR,
63
            ],
64
            $stackcollapse_pipes
65
        );
66
67
        proc_close($stackcollapse_process);
68
        proc_close($flamegraph_process);
69
70
        return 0;
71
    }
72
}
73