Permalink
Browse files

Add a test case and some D expressions for OS.Io_page.

  • Loading branch information...
1 parent 64370b4 commit 4c79402f69a3ea1b87d1d3d7babe7fd485662de5 @pgj committed Aug 12, 2012
@@ -78,3 +78,13 @@ mirage:kernel:alloc_pages:return
{
printf("<- %s()\n", probefunc);
}
+
+mirage:kernel:io_page:contigmalloc
+{
+ printf("%p = %s:%s(%d)\n", arg1, probeprov,probefunc, arg0);
+}
+
+mirage:kernel:io_page:contigfree
+{
+ printf("%s:%s(%p,%d)\n", probeprov, probefunc, arg0, arg1);
+}
@@ -0,0 +1,18 @@
+#!/usr/sbin/dtrace -s
+
+#pragma D option quiet
+
+mirage:kernel:io_page:refcount
+{
+ printf("%s:%s(%p,%d)\n", probefunc,probename, arg0, arg1);
+}
+
+mirage:kernel:io_page:contigmalloc
+{
+ printf("%s:%s(%p,%d)\n", probefunc,probename, arg1, arg0);
+}
+
+mirage:kernel:io_page:contigfree
+{
+ printf("%s:%s(%p,%d)\n", probefunc, probename, arg0, arg1);
+}
@@ -83,6 +83,11 @@ perf/gcperf:
echo "let _ = OS.Main.run (Gcperf.main ())" > main.ml
${MAKE} -f Makefile.kmod SRCS=gcperf.ml KMOD=mirage-perf-gcperf
+perf/io_page:
+ ln -sf perf/io_page.ml .
+ echo "let _ = OS.Main.run (Io_page.main ())" > main.ml
+ ${MAKE} -f Makefile.kmod SRCS=io_page.ml KMOD=mirage-perf-io_page
+
perf/sieve:
ln -sf perf/sieve.ml .
echo "let _ = OS.Main.run (Sieve.main ())" > main.ml
@@ -0,0 +1,29 @@
+open Printf
+open Lwt
+
+let with_time i label fn =
+ let t1 = OS.Clock.time () in
+ fn ();
+ let t2 = OS.Clock.time () in
+ let passed = (t2 - t1) / 1000 in
+ printf "%s,%d,%d,%d ms\n%!" Sys.os_type i label passed
+
+let main () =
+ Random.self_init ();
+ let page_size = 4096 in
+ let sizes = [ 1; 2; 4; 8; 16; 32; 64; 128; 256; 512 ] in
+ List.iter (fun sz ->
+ with_time sz sz (fun () ->
+ for i = 0 to 1000 do
+ let ts = OS.Io_page.get_n sz in
+ for j = 0 to (sz * 100) do
+ let off = Random.int page_size in
+ let len = Random.int (page_size - off) in
+ let k = Random.int sz in
+ let _ = OS.Io_page.sub (List.nth ts k) off len in
+ ()
+ done;
+ done;
+ )
+ ) sizes;
+ return ()

0 comments on commit 4c79402

Please sign in to comment.