[ECOS] libc-time-clock test doesn't seem to be written correctly??
Jonathan Larmour
jifl@eCosCentric.com
Fri Jun 13 05:39:00 GMT 2003
Brij Bihari Pandey wrote:
> Hi,
>
> I have few doubts about
> packages/language/c/libc/time/current/tests/clock.c Doesn't look like
> that this test will function correctly (as desired by test writers).
>
> - It is quite possible that clock_loop returns "0", as the code there
> breaks out in the first iteration of for-loop and it happens more or
> less consistently in all the calls to clock_loop. In this case, the
> mean value in main will turn out to be zero causing division-by-zero in
> err calculation.
It's true that there does seem to be an assumption there, although that
assumption has been right before because each call to clock_loop will
follow the previous one faster than clock() will increment on virtually
all processors. I'll fix it with:
// use mean+1 as divisor to avoid div-by-zero
err = (100 * my_abs(ctrs[i]-mean)) / (mean+1);
> Another related thought - shouldn't the analysis of going through valid
> results and comparing against average -- be done using floating point
> arithmetic for mean/err computation and comparision?
Why bother?
> - Should test fail on first err value, that is not within TOLERANCE? It
> may be better if failure-tolerance (another parameter) is taken on
> number-of-samples not within TOLERANCE limit, to decide the
> test-failure.
If the system disappears into the middle of nowhere for a long time before
coming back even once, then something needs investigating. It may be
alright, but that's not up to this test to know.
> What I gather from the comments in the test, that it tests -
> - if clock is working or not,
> - if it is stable (PASS message) or not.
>
> Am I right in my understading the purpose of this test?
Yes.
> Though I don't quite get - - What is meant by stability of clock? - In
> what way the nature of test ensures it is testing stability of clock?
Roughly equal period between clock increments.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list