Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
BlackfireDumper.php
01 <?php
02
03 /*
04 * This file is part of Twig.
05 *
06 * (c) Fabien Potencier
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Twig\Profiler\Dumper;
13
14 use Twig\Profiler\Profile;
15
16 /**
17 * @author Fabien Potencier <fabien@symfony.com>
18 */
19 final class BlackfireDumper
20 {
21 public function dump(Profile $profile)
22 {
23 $data = [];
24 $this->dumpProfile('main()', $profile, $data);
25 $this->dumpChildren('main()', $profile, $data);
26
27 $start = sprintf('%f', microtime(true));
28 $str = <<<EOF
29 file-format: BlackfireProbe
30 cost-dimensions: wt mu pmu
31 request-start: {$start}
32
33
34 EOF;
35
36
37 foreach ($data as $name => $values) {
38 $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n";
39 }
40
41 return $str;
42 }
43
44 private function dumpChildren(string $parent, Profile $profile, &$data)
45 {
46 foreach ($profile as $p) {
47 if ($p->isTemplate()) {
48 $name = $p->getTemplate();
49 } else {
50 $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName());
51 }
52 $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data);
53 $this->dumpChildren($name, $p, $data);
54 }
55 }
56
57 private function dumpProfile(string $edge, Profile $profile, &$data)
58 {
59 if (isset($data[$edge])) {
60 ++$data[$edge]['ct'];
61 $data[$edge]['wt'] += floor($profile->getDuration() * 1000000);
62 $data[$edge]['mu'] += $profile->getMemoryUsage();
63 $data[$edge]['pmu'] += $profile->getPeakMemoryUsage();
64 } else {
65 $data[$edge] = [
66 'ct' => 1,
67 'wt' => floor($profile->getDuration() * 1000000),
68 'mu' => $profile->getMemoryUsage(),
69 'pmu' => $profile->getPeakMemoryUsage(),
70 ];
71 }
72 }
73 }
74
75 class_alias('Twig\Profiler\Dumper\BlackfireDumper', 'Twig_Profiler_Dumper_Blackfire');
76