This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: make fastcheck


Hi!
One of the critical things in making the tests faster is actually paying
attention to the tests themselves. In the Linux Test Project I saved a
minutes of runtime just by sorting the tests by runtime and reviewing the
outliners. In half of the cases the time could be reduced significantly
just by making a small bit of an effort.

One of the most common problems in our tests was sleep() being used as a
poor man's synchronization primitive. Greping libc sources there are 45
tests that call sleep() and more than half of that is in the nptl/
directory so there may be a room for improvement.

We had similar situation in LTP a few years ago and I've fixed that by
writing a test library that provides several replacements for the
sleep().

One of them is really simple checkpoint synchronization library based on
futexes that allows to suspend processes until the other process is
ready and wakes it up.

Another one is basically a loop that polls /proc/$pid/stat which is used
when process needs to wait for another process that suspends itself in a
sleep state.

And we also have a macro that implements bussy loop wait with
exponential increase in sleep time that replaces the
while (not_ready) sleep(1); loops which almost always wastes 1 second of
runtime.

-- 
Cyril Hrubis
chrubis@suse.cz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]