fun timing (action) = let val timer = Timer.startCPUTimer () val result = action () val times = Timer.checkCPUTimer timer in (result, Time.+ (#usr times, #sys times)) end fun main (name,args) = let open BrunelCaseB fun finfo ((Inh_state_vector, Exc_state_vector, Ext_state_vector),out) = () in (let val _ = putStrLn TextIO.stdOut ("starting fprojection...") val (S,t) = timing fprojection val _ = putStrLn TextIO.stdOut ("fprojection took " ^ (Time.toString t) ^ " s") val out = TextIO.openOut (label ^ ".dat") in List.app (fn (s) => putStrLn out ("# " ^ s)) ([ label, ("delay = " ^ (Real.toString delay)), ("g = " ^ (Real.toString g)) ]); let val _ = putStrLn TextIO.stdOut ("starting simulation...") val (_,t) = timing (fn () => Sim.start (1200.0, N, S, D, Pn, initial, frun, ftime, fspikes, finfo, out)) in putStrLn TextIO.stdOut ("simulation took " ^ (Time.toString t) ^ " s") end; TextIO.flushOut (out); TextIO.closeOut (out) end) end val _ = let val name = CommandLine.name() val args = CommandLine.arguments() val env = Posix.ProcEnv.environ() in main (name, args) end