$performanceData */ $performanceData = [ 'currentMemoryUsage' => $this->memoryMonitor->getCurrentMemory()->toHumanReadable(), 'peakMemoryUsage' => $this->memoryMonitor->getPeakMemory()->toHumanReadable(), 'memoryLimit' => $this->memoryMonitor->getMemoryLimit()->toHumanReadable(), 'memoryUsagePercentage' => $this->memoryMonitor->getMemoryUsagePercentage()->format(2), 'loadAverage' => function_exists('sys_getloadavg') ? sys_getloadavg() : ['N/A', 'N/A', 'N/A'], 'opcacheEnabled' => function_exists('opcache_get_status') ? 'Ja' : 'Nein', 'executionTime' => number_format(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], 4) . ' Sekunden', 'includedFiles' => count(get_included_files()), 'files' => get_included_files(), ]; if (function_exists('opcache_get_status')) { try { $opcacheStatus = opcache_get_status(false); if ($opcacheStatus !== false) { $memoryUsed = Byte::fromBytes($opcacheStatus['memory_usage']['used_memory']); $performanceData['opcacheMemoryUsage'] = $memoryUsed->toHumanReadable(); $performanceData['opcacheCacheHits'] = number_format($opcacheStatus['opcache_statistics']['hits']); $hits = $opcacheStatus['opcache_statistics']['hits']; $misses = $opcacheStatus['opcache_statistics']['misses']; $total = $hits + $misses; if ($total > 0) { $missRate = Percentage::from(($misses / $total) * 100); $performanceData['opcacheMissRate'] = $missRate->format(2) . '%'; } } } catch (\Throwable $e) { $performanceData['opcacheError'] = $e->getMessage(); } } $data = [ 'title' => 'Performance-Daten', 'performance' => $performanceData, 'current_year' => $this->clock->now()->format('Y'), 'timestamp' => $this->clock->now()->format('Y-m-d H:i:s'), ]; $finalData = $this->layoutProcessor->processLayoutFromArray($data); return new ViewResult( template: 'performance', metaData: new MetaData('Performance-Daten', 'Performance-Daten'), data: $finalData ); } #[Auth] #[Route(path: '/admin/system/performance/api/realtime', method: Method::GET)] public function getRealtimeMetrics(Request $request): JsonResult { $currentMemory = $this->memoryMonitor->getCurrentMemory(); $peakMemory = $this->memoryMonitor->getPeakMemory(); $usagePercentage = $this->memoryMonitor->getMemoryUsagePercentage(); return new JsonResult([ 'memory' => [ 'current' => $currentMemory->toHumanReadable(), 'peak' => $peakMemory->toHumanReadable(), 'usage_percentage' => round($usagePercentage->getValue(), 1), ], 'timestamp' => $this->clock->now()->format('Y-m-d H:i:s'), ]); } }