Fabio Mascarenhas wrote:
Shmuel, the only changes from 2.0.1 to the current CVS are these fixes, so feel free to try. :-)
OK, I felt free and tried :)
The 4-th test case:
require"profiler"
profiler.stop()
profiler.stop() --> crash here
Sorry, couldn't reproduce this... the code is already guarding against a stop without a start, so it shouldn't matter if you are doing one stop or 10. :-)
The 5-th test case:
require"profiler"
profiler.start()
profiler.start() --> takes 7.7 sec. on my machine;
-- makes a nonsensical dump file containing 100003 lines.
It's not really nonsensical, it's profiling a loop that measures the overhead of function calling (ti discount it from the times) with 100.000 function calls, so that is where all these lines are coming from. :-) But you are correct that the profiler is not meant to be reentrant, so I'll put guards against that. Not critical enough for 2.0.3 in such a short order, IMHO (the coroutine bug you surfaced previously was).
IMHO, since the library isn't meant to allow nested start/stop calls, it should just check its state ("started" or not) on every start/stop call and either raise an error or simply ignore the out-of-order calls.
--
Shmuel