aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/php-on-wasm/php-wasm.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-03-13 22:12:59 +0900
committernsfisis <nsfisis@gmail.com>2024-03-13 22:13:02 +0900
commit7348999caf3ce1e0be64697319581d52f1d7f8ea (patch)
tree21f864b62825c79aa74c1ed935dfa801c00c42a6 /examples/php-on-wasm/php-wasm.php
parentb89054b420235df9b9d7815bf9fad71e3b361395 (diff)
downloadphp-waddiwasi-7348999caf3ce1e0be64697319581d52f1d7f8ea.tar.gz
php-waddiwasi-7348999caf3ce1e0be64697319581d52f1d7f8ea.tar.zst
php-waddiwasi-7348999caf3ce1e0be64697319581d52f1d7f8ea.zip
perf: log instruction metrics
Diffstat (limited to 'examples/php-on-wasm/php-wasm.php')
-rw-r--r--examples/php-on-wasm/php-wasm.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php
index 75e9c3f..b5a9fed 100644
--- a/examples/php-on-wasm/php-wasm.php
+++ b/examples/php-on-wasm/php-wasm.php
@@ -153,6 +153,10 @@ $exitCode = $result->inner->value;
fprintf(STDERR, "Exit code: $exitCode\n");
fprintf(STDERR, "Memory peak usage: %s\n", memory_get_peak_usage());
+fprintf(STDERR, "\n\n");
+foreach ($runtime->getInstrMetrics() as $instr => $count) {
+ fprintf(STDERR, "%s: %d\n", $instr, $count);
+}
function allocateStringOnWasmMemory(Runtime $runtime, string $str): int {
// Plus 1 for the null terminator in C.