Skip to content

Commit

Permalink
commit code used for debug
Browse files Browse the repository at this point in the history
d
  • Loading branch information
mvorisek committed May 18, 2021
1 parent 88a5eed commit 2f14329
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
12 changes: 6 additions & 6 deletions anal/simplify_trace.php
Expand Up @@ -60,7 +60,7 @@ public function getFixedLine(): ?string
}

$origLLen = strlen($l);
$l = preg_replace('~^.{22}(?= *->)~', '', $l);
$l = preg_replace('~^.{22}(?= *(?:->|>=>))~', '', $l);
if (strlen($l) === $origLLen) {
if (preg_match('~^TRACE END ~', $this->getNextLine())) { // verify end
if ($this->getNextLine() !== '') { // skip
Expand Down Expand Up @@ -89,8 +89,8 @@ public function writeLine(string $line): void

public function convertFile(): void
{
$statLines = 0; // based on fixed size
$statSize = 0; // based on fixed size
$statLines = 0;
$statSize = 0; // based on fixed line size
$statStartTs = microtime(true);
while (true) {
$l = $this->getFixedLine();
Expand All @@ -112,9 +112,9 @@ public function convertFile(): void

foreach (array_diff(scandir(__DIR__ . '/in'), ['.', '..']) as $n) {

// if (!preg_match('~no-opcache~', $n)) {
// continue;
// }
if (!preg_match('~c1~', $n)) {
continue;
}

echo '-- starting: ' . $n . "\n";
$fNoOpcache = new File(__DIR__ . '/in/' . $n, __DIR__ . '/out/' . $n);
Expand Down
22 changes: 14 additions & 8 deletions run.php
Expand Up @@ -12,11 +12,13 @@

$cmd = 'cd "' . __DIR__ . '/ui' . '" & phpw .. 1GB --with-xdebug'
. ' -d opcache.enable=' . ($withOpcache ? 1 : 0)
. ' -d xdebug.auto_trace=1'
. ' -d xdebug.collect_params=3'
. ' -d opcache.cache_id=816'
. ' -d xdebug.auto_trace=' . (basename($resPath) === 't_discard' ? 0 : 1)
. ' -d xdebug.collect_params=3' // use 1 for types only
. ' -d xdebug.collect_return=1'
//. ' -d xdebug.collect_assignments=1'
. ' -d xdebug.var_display_max_depth=0'
. ' -d xdebug.trace_output_dir="' . __DIR__ . '"'
. ' -d xdebug.trace_output_dir="' . dirname($resPath) . '"'
. ' -d xdebug.trace_output_name="' . basename($resPath) . '"'
. ' ../bin/phpstan analyse'; //--xdebug --debug --verbose
echo '----- running:' . "\n" . $cmd . "\n";
Expand All @@ -25,10 +27,14 @@
echo '----- finished in: ' . (microtime(true) - $t) . " seconds\n\n";
};

$runPhpStanWithTracing(__DIR__ . '/t_c0', false); // discard first run
$analInDir = __DIR__ . '/anal/in';

$runPhpStanWithTracing(__DIR__ . '/t_c0', false);
$runPhpStanWithTracing(__DIR__ . '/t_c1', true);
$runPhpStanWithTracing($analInDir . '/t_discard', true); // discard first run
exit;
$runPhpStanWithTracing($analInDir . '/t_discard', false); // discard first run

$runPhpStanWithTracing(__DIR__ . '/t_c0_2nd', false);
$runPhpStanWithTracing(__DIR__ . '/t_c1_2nd', true);
$runPhpStanWithTracing($analInDir . '/t_c0', false);
$runPhpStanWithTracing($analInDir . '/t_c1', true);

//$runPhpStanWithTracing($analInDir . '/t_c0_2nd', false);
//$runPhpStanWithTracing($analInDir . '/t_c1_2nd', true);
2 changes: 1 addition & 1 deletion src/Command/AnalyseApplication.php
Expand Up @@ -212,7 +212,7 @@ private function runAnalyser(

private function updateMemoryLimitFile(): void
{
$bytes = memory_get_peak_usage(true);
$bytes = 1024 * 1024 * 1024;//memory_get_peak_usage(true);
$megabytes = ceil($bytes / 1024 / 1024);
file_put_contents($this->memoryLimitFile, sprintf('%d MB', $megabytes));
}
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/ContainerFactory.php
Expand Up @@ -136,7 +136,7 @@ public function clearOldContainers(string $tempDirectory): void

$finder = new Finder();
$finder->name('Container_*')->in($configurator->getContainerCacheDirectory());
$twoDaysAgo = time() - 24 * 60 * 60 * 2;
/*$twoDaysAgo = time() - 24 * 60 * 60 * 2;
foreach ($finder as $containerFile) {
$path = $containerFile->getRealPath();
Expand All @@ -151,7 +151,7 @@ public function clearOldContainers(string $tempDirectory): void
}
@unlink($path);
}
}*/
}

public function getCurrentWorkingDirectory(): string
Expand Down

0 comments on commit 2f14329

Please sign in to comment.