This is the mail archive of the cygwin-developers mailing list for the Cygwin 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: timeBeginPeriod considered harmful


----- Original Message ----- From: "Christopher Faylor"
To: <cygwin-developers@cygwin.com>
Sent: Thursday, November 10, 2005 11:14 PM
Subject: timeBeginPeriod considered harmful



In times.cc we (I?) call the timeBeginPeriod with the minimal setting
allowed
for the system.  While this generally allows 1 millisecond resolution, it
also
seems to imply that the system is now being interrupted much more often.
I
am beginning to think that this is not a good thing, especially after
reading
the following blog:

http://blogs.msdn.com/larryosterman/archive/2005/09/08/462477.aspx

I'm thinking of going back to using tick resolution in cygwin where a
tick is several milliseconds.  This may cause problems for people who
have gotten used to millisecond resolution but I think it may solve some
of the problems we've seen with people who claim that cygwin is eating
all of their CPU and it possibly could fix the strange problem of the
hanging open office builds.

I was thinking of implementing a (clutch chest, gasp!) non-POSIX
clock_setres() (or maybe a cygwin_clock_setres) function to allow people
to set the resolution to a millisecond if that is really what they want.
Otherwise, it seems like functions which query the time at < 1 second
resolution are well within their rights if they return dates based on
some arbitrary system resolution.

Does anyone have any experience with the timer functions?  Pierre are
you still out there?  I think you had some experience with this.

Not everything in the blog is true (see follow ups) and I don't know what to believe.

I worked on the resolution issue a while back, to insure the following
Posix behavior (exim relies on it):
If you 1) call time() or equivalent, 2) sleep() or alarm() for some
interval, 3) call time() again, then the difference between the times in
3) and 1) cannot be smaller than the interval in 2).  Insuring that is
easier if the resolution is known.
I am not sure if Cygwin still behaves that way, insuring it requiring
rounding up at various places.

It has been a while since I looked at at. I will refresh my memory next week

I am fairly sure that I thought about the performance issue and didn't
observe anything negative on WinMe when the resolution was set at 1 ms.
With all the multimedia stuff going on PCs these days I would be surprised
if there was an impact that can be be blamed on Cygwin. But then,
Windows has surprised me many times.

Pierre





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