Skip to content

Commit

Permalink
Some minor fixes for the output of the memory reader command
Browse files Browse the repository at this point in the history
  • Loading branch information
sj-i committed Nov 19, 2023
1 parent 44cb2bc commit e94ae50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Command/Inspector/MemoryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public function execute(InputInterface $input, OutputInterface $output): int
echo json_encode(
[
'summary' => $summary,
"per_type_analysis" => $heap_location_type_summary->per_type_usage,
'per_class_analysis' => $object_class_summary->per_class_usage,
"location_types_summary" => $heap_location_type_summary->per_type_usage,
'class_objects_summary' => $object_class_summary->per_class_usage,
'context' => $analyzed_context,
],
JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function analyze(MemoryLocations $memory_locations): ObjectClassAnalyzerR
$per_class_usage[$class_name]['memory_usage'] += $memory_location->size;
}
}
uasort(
$per_class_usage,
fn ($a, $b) => $b['memory_usage'] <=> $a['memory_usage']

Check failure on line 41 in src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php

View workflow job for this annotation

GitHub Actions / psalm static code analysis

MixedArrayAccess

src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php:41:28: MixedArrayAccess: Cannot access array value on mixed variable $b (see https://psalm.dev/051)

Check failure on line 41 in src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php

View workflow job for this annotation

GitHub Actions / psalm static code analysis

MixedArrayAccess

src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php:41:51: MixedArrayAccess: Cannot access array value on mixed variable $a (see https://psalm.dev/051)

Check failure on line 41 in src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php

View workflow job for this annotation

GitHub Actions / psalm static code analysis

MixedArrayAccess

src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php:41:28: MixedArrayAccess: Cannot access array value on mixed variable $b (see https://psalm.dev/051)

Check failure on line 41 in src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php

View workflow job for this annotation

GitHub Actions / psalm static code analysis

MixedArrayAccess

src/Lib/PhpProcessReader/PhpMemoryReader/ObjectClassAnalyzer/ObjectClassAnalyzer.php:41:51: MixedArrayAccess: Cannot access array value on mixed variable $a (see https://psalm.dev/051)
);
return new ObjectClassAnalyzerResult($per_class_usage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function analyze(MemoryLocations $memory_locations): RegionAnalyzerResult

uasort(
$per_class_objects,
fn (array $a, array $b) => $b['count'] <=> $a['count']
fn (array $a, array $b) => $b['total_size'] <=> $a['total_size']
);

$heap_memory_usage += $possible_allocation_overhead_total;
Expand Down

0 comments on commit e94ae50

Please sign in to comment.