| | $elapsed = microtime( true ) - $this->pTimers[$name]; |
| | |
| | + // Initialize stat entry if missing |
| | if( !isset( $this->pStats[$name] ) ) { |
| | $this->pStats[$name] = ['cnt' => 0, 'time' => 0.0]; |
 |
| | |
| | public function profileReport(): string { |
| | + if (empty($this->pStats)) { |
| | + return "\n\n"; |
| | + } |
| | + |
| | + // Sort by total time descending |
| | uasort( $this->pStats, fn($a, $b) => $b['time'] <=> $a['time'] ); |
| | |
| | - $out = ""; |
| | + $out = "\n\n"; |
| | return $out; |
| | } |
| | |
| | - // --- Core Methods --- |
| | + // --- Core Methods (Instrumented) --- |
| | |
| | public function setRepository($repoPath) { |
 |
| | |
| | private function readDeltaTargetSize( $fileHandle, int $type, string $buffer, int $pos ): int { |
| | + $this->enter( __METHOD__ ); |
| | if( $type === 6 ) { |
| | $byte = ord( $buffer[$pos++] ); |
 |
| | } |
| | |
| | + $this->leave( __METHOD__ ); |
| | return $result; |
| | } |
 |
| | |
| | $isDir = ($mode === self::MODE_TREE || $mode === self::MODE_TREE_A); |
| | + |
| | + // Recursive call tracked |
| | $size = $isDir ? 0 : $this->getObjectSize( $entrySha ); |
| | |