[phobos] Proposal of StopWatch module

SHOO zan77137 at nifty.com
Tue Aug 17 21:46:27 PDT 2010


(2010/08/17 22:39), Michal Minich wrote:
> On Tue, 17 Aug 2010 19:43:41 +0900, SHOO wrote:
>
>  > Here is the module to suggest this time:
>  > http://ideone.com/TVw1P
>
> Very nicely coded. I think much better than the messing std.perf. Few
> things...
>
> 1. I didn't found initialization of APPORIGIN. Is it meant to be
> initialized in runtime, or else module constructor comes to my mind...
>

Oh... I'll fix it.

> 2. As a user of this module, I would much prefer to have an exception
> throw when I call start or stop function out of order, instead of silent
> return. If the only returns, there semantic requirement for having stop
> function - it is has then same meaning as peek.
>

There are three ways:
1. enforce
2. assert
3. return;

Which do you like?
I like #2 because I want to suppress influence to runtime.

> 3. in std.perf the mili and microseconds use some special casing for
> computation. I suppose it is to increase floating point accuracy. Does
> this casing applies to your module and can it be used to increase
> accuracy ?
>

Because there is the issue of license, I don't look std.perf either.
I thought about it just a bit, too, but stopped it because somebody felt 
like researching it.
I suppose that it may change a method of the division dynamically.
However, I do not reach it to find a concrete method.

> and some much less important things...
>
> 4. I personally would prefer names like sec, usec, msec instead the
> longer you use.
>

About it, I intend to prepare for alias.

> 5.  m_TimeObject is not an instance of any class. Better name could be
> probably "m_TimeInit" "m_TimeInstanceInit"
>
> 6. Wouldn't be better to name the variable "m_FlagObserving" or
> "m_FlagStarted" ?
>
> 7. ovserving is misspelled.
>

Thanks for your advice! I'll consider your opinion.


More information about the phobos mailing list