Index: pkg/kernel/test/ast_membench.sh |
diff --git a/pkg/kernel/test/ast_membench.sh b/pkg/kernel/test/ast_membench.sh |
new file mode 100755 |
index 0000000000000000000000000000000000000000..887ad04fa44d50aae9c0a7f7082e401b7ec4199b |
--- /dev/null |
+++ b/pkg/kernel/test/ast_membench.sh |
@@ -0,0 +1,15 @@ |
+testdir=$(dirname $0) |
kustermann
2017/02/01 13:00:55
add
#!/bin/sh
and chmod +x ?
asgerf
2017/02/02 12:30:27
Done.
|
+first_input=10 |
+first_output=$(mktemp) |
+dart --print-metrics $testdir/ast_membench.dart $1 $first_input >/dev/null 2>$first_output |
+second_input=20 |
+second_output=$(mktemp) |
+dart --print-metrics $testdir/ast_membench.dart $1 $second_input >/dev/null 2>$second_output |
+ |
+bytes1=$(fgrep 'heap.old.used.max' $first_output | head -n1 | cut -d' ' -f4) |
+bytes2=$(fgrep 'heap.old.used.max' $second_output | head -n1 | cut -d' ' -f4) |
+ |
+bytes=$(echo "($bytes2 - $bytes1)/($second_input - $first_input)" | bc) |
+mega_bytes=$(echo "$bytes / 1000000" | bc) |
+printf "Memory usage = %d B (%2.2f MB)" $bytes $mega_bytes |
+echo |
kustermann
2017/02/01 13:00:55
remove first_output/second_output again
asgerf
2017/02/02 12:30:27
Done.
|