diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-12 15:15:31 +0100 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2009-03-15 23:02:07 +0100 |
commit | b0fe551000179c868d46266278a890eab878baca (patch) | |
tree | 2881090d0a3da1508dc51abffe358406e0527fe1 /scripts/kconfig/util.c | |
parent | kconfig: fix randconfig for choice blocks (diff) | |
download | linux-b0fe551000179c868d46266278a890eab878baca.tar.xz linux-b0fe551000179c868d46266278a890eab878baca.zip |
kconfig: improve seed in randconfig
'make randconfig' uses glibc's rand function, and the seed of
that PRNG is set via:
srand(time(NULL));
But 'time()' only increases once every second - freezing the
randconfig result within a single second.
My Nehalem testbox does randconfig much faster than 1 second
and i have a few scripts that do 'randconfig until condition X'
loops.
Those scripts currently waste a lot of CPU time due to randconfig
changing its seed only once per second currently.
Change the seed to be micrseconds based. (I checked the statistical
spread of the seed - the now.tv_sec*now.tv_usec multiplication
there further improves it.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Roman Zippel <zippel@linux-m68k.org>
[sam: fix for systems where usec is zero - noticed by Geert Uytterhoeven]
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/util.c')
0 files changed, 0 insertions, 0 deletions