aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-03-14 00:18:17 +0900
committernsfisis <nsfisis@gmail.com>2024-03-14 00:18:51 +0900
commit44f5eb882bcaab2f5a19a0d7680929d6b0463f62 (patch)
tree0e77b8a6143f7bfdde8c073413f9807268b41aef /src
parent4b7e894a397def9b14d8e3f589ec159dfb788ed8 (diff)
downloadphp-waddiwasi-44f5eb882bcaab2f5a19a0d7680929d6b0463f62.tar.gz
php-waddiwasi-44f5eb882bcaab2f5a19a0d7680929d6b0463f62.tar.zst
php-waddiwasi-44f5eb882bcaab2f5a19a0d7680929d6b0463f62.zip
perf: log instr metrics
Diffstat (limited to 'src')
-rw-r--r--src/Execution/Runtime.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php
index 5f04978..fa1689a 100644
--- a/src/Execution/Runtime.php
+++ b/src/Execution/Runtime.php
@@ -157,7 +157,7 @@ final class Runtime
*/
public function getInstrMetrics(): array
{
- ksort($this->instrMetrics);
+ asort($this->instrMetrics);
return $this->instrMetrics;
}
@@ -324,10 +324,9 @@ final class Runtime
static $debug = 0;
// if ($debug >= 3) echo "Exec: " . $instr::opName() . "\n";
- // $this->instrMetrics[$instr::opName()] ??= 0;
- // $this->instrMetrics[$instr::opName()]++;
+ // $start = hrtime(true);
- return match ($instr::class) {
+ $result = match ($instr::class) {
Instrs\Numeric\F32Abs::class => $this->execInstrNumericF32Abs($instr),
Instrs\Numeric\F32Add::class => $this->execInstrNumericF32Add($instr),
Instrs\Numeric\F32Ceil::class => $this->execInstrNumericF32Ceil($instr),
@@ -534,6 +533,11 @@ final class Runtime
Instrs\Control\Unreachable::class => $this->execInstrControlUnreachable($instr),
default => throw new \RuntimeException("invalid instruction"),
};
+
+ // $this->instrMetrics[$instr::opName()] ??= 0;
+ // $this->instrMetrics[$instr::opName()] += hrtime(true) - $start;
+
+ return $result;
}
private function execInstrNumericF32Abs(Instrs\Numeric\F32Abs $instr): void