X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=test_ancient_weblogs.ml;h=30f1e95986de0f9540cf53581080f5bd99bd24d7;hb=eed732850571438657c80b760a3f7a40c62384d7;hp=946075b4b0f46d248ba9074d95a40772ac648c1a;hpb=70ed84c05dfe890425592cc207f7a866f0afb04e;p=ocaml-ancient.git diff --git a/test_ancient_weblogs.ml b/test_ancient_weblogs.ml index 946075b..30f1e95 100644 --- a/test_ancient_weblogs.ml +++ b/test_ancient_weblogs.ml @@ -1,5 +1,5 @@ (* Load in large weblogs and see if they can still be used. - * $Id: test_ancient_weblogs.ml,v 1.1 2006-09-27 14:05:07 rich Exp $ + * $Id: test_ancient_weblogs.ml,v 1.3 2006-09-28 12:40:07 rich Exp $ *) open Printf @@ -71,18 +71,28 @@ let files = files +(* XXX Linux/AMD64-specific hack to avoid bad mmap(2) allocation. *) +let baseaddr = Nativeint.of_string "0x440000000000" + +let md = + let fd = + Unix.openfile "test_ancient_weblogs.data" + [Unix.O_RDWR; Unix.O_CREAT; Unix.O_TRUNC] 0o644 in + Ancient.attach fd baseaddr + (* Load each file into memory and make it ancient. *) let () = - let files = - List.map ( - fun filename -> - eprintf "Importing file %s\n%!" filename; - let rows = - let rows = Weblogs.import_file filename in - Ancient.mark rows in - gc_compact (); - rows - ) files in + List.iteri ( + fun key filename -> + let () = + let basename = Filename.basename filename in + eprintf "Importing logfile %s\n%!" basename; + let rows = Weblogs.import_file filename in + ignore (Ancient.share md key rows) in + gc_compact () + ) files; + + - ignore (files) + Ancient.detach md