[M3commit] CVS Update: cm3

Jay Krell jkrell at elego.de
Thu Jul 22 16:59:48 CEST 2010

CVSROOT:	/usr/cvs
Changes by:	jkrell at birch.	10/07/22 16:59:48

Modified files:
	cm3/m3-libs/m3core/src/time/POSIX/: TimePosixC.c 

Log message:
	Grain computation seems like a poorly implemented thing.
	I'm hoping we can replace it with something sysconf(?) or clock_getres.
	Experiments with clock_getres suggest no. It is often much larger than grain.
	Though it was close on Alpha/OSF I think.
	In the meantime:
	Historically we just computed grain once and accepted that value.
	Per the historical comment, that seemed not great. I changed it
	to loop until 2 or 3 grains were computed identically.
	I see this hang sometimes. Though seemingly only in
	slightly unusual situations like a cross build or Alpha/OSF or in a debugger.
	Anyway, let's try a different variation:
	Compute it a few times, and take the smallest value we find.
	I've tried up to 5 and it still varies from run to run on Alpha/OSF.
	So go down to just 3 since I can't win, and every computation takes
	time -- waiting for the time to progress.
	This still seems better than the historical behavior of one computation
	that might go very awry, and has the advantage over the replacement
	I had put in, which potentially could loop forever -- if grain
	was larger than scheduling interval, though nobody has reported that.

More information about the M3commit mailing list