Boost logo

Boost :

Subject: Re: [boost] [timer] Boost Timer Library Version 2
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-09-28 13:10:12


Beman Dawes write:
> On Tue, Sep 27, 2011 at 11:42 AM, Stewart, Robert
> <Robert.Stewart_at_[hidden]> wrote:
> > Beman Dawes wrote:
>
> I've done another pass through the reference section, making
> both corrections and clarifications. Where the resulting spec
> still seemed likely to baffle those not used to the style of
> the standard library, I've added a non-normative "Overview:"
> element.

That's much better. I don't think that start() should be defined as storing anything. "Note" might be a better verb as it doesn't specify implementation. (This idea applies to stop(), too.)

> > - There's no information on thread safety. stop(), for
> > example, is not reentrant.
>
> OK, paragraph added.

Where?

> > - There's no information on Boost.Timers overhead relative
> > to timing the target code.
>
> I've added a "Timer accuracy" section to the docs. I'd welcome
> a patch to test/cpu_timer_info.cpp that actually measured
> overhead.

That's a nice start.

In "Other concerns":

 - "such as when the clock is reset such as" is awkward. How about, "other processes. The clock may even run backward on some cases when, for example, the clock is reset due to a daylight saving time transition." (Note that the "S" in "DST" is "saving" not "savings".)

 - s/I.E/i.e.,/

 - s/optimized way/optimized away/

In the second paragraph of "Recommendations", I'd change from "my personal preference" to "a good approach" or similar.

> > However, even better would be the following which accounts
> > for "%%" producing "%" and "%x" producing "%x" for any "x"
> > not in "wustp". The latter in the output would be a clue to
> > the user that it was not a recognized conversion
> > specification.
> >
> > if (*format != '%')
> > {
> > os << *format;
> > }
> > else if (*(format + 1))
> > {
> > ++format;
> > switch (*format)
> > {
> > case 'w':
> > // and so on for u, s, t, and p
> > break;
> > case '%':
> > os << '%';
> > break;
> > default:
> > os << '%' << *format;
> > break;
> > }
> > }
>
> The default and assert has been removed. KISS.

I appreciate KISS, but I think my version is at least as simple as yours and it addresses what I think is surprising behavior, relative to printf(), with your current handling of %.

> > cpu_timer.cpp::tick_factor() is a non-trivial function, yet
> > cpu_timer.cpp::get_cpu_times() calls it thrice in a row in
                                            ^^^^^^
> > the non-Windows code.
>
> Actually, three times. Fixed.

See ^^^^^^ above ;-) I know, not many people use "thrice" these days.

> > Shouldn't some of those use cases be documented with
> > examples to illustrate the flexibility of the API?
>
> Sure! Care to submit something?

See my other e-mail regarding resume() for a start.

> Actually, you've already contributed so much that I'd be happy
> to list you as a co-author!

I'd love that! Thank you.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer using std::disclaimer;
Dev Tools & Components
Susquehanna International Group, LLP http://www.sig.com

________________________________

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk