Erlang Development Environment

matthias <>
Tue Mar 6 09:14:26 CET 2001


 > 2. A shell command for timing specific pieces of code.  Something where you
 > can specify a function, parameters, and the number of times to execute that
 > function.  In Lisp I'm always doing this:
 > 
 > (time (dotimes (i 1000000) (test 0 1 2)))
 > 
 > I don't know a simple equivalent in Erlang.


timer:tc(io, fwrite, ["hello world\n"]).
hello world
{222,ok}

222 means "222 microseconds of wall time elapsed during execution".

3> timer:tc(timer, sleep, [1000]).                               
{1004227,ok}

Matthias



More information about the erlang-questions mailing list