# To subscribers of the xforms list from David Paigen <paigen@heathen.com> :
I wrote:
> Steve wrote:
> > I suppose the next thing to try is to change fl_set_idle_delta() to
> > accept zero as a valid delta. I don't think that should break
> > anything. Give it a try.
>
> I will go try that.
[...]
> I'll send out a note in a couple of hours about the patch.
Or less. :-) Patching forms.c worked perfectly! I am back up
to circa 6000 idle calculations per second. This value depends,
of course, on the size of the calculations. Your mileage may
vary.
Oh, and Steve, I made a slight mod to the timeout demo you sent
the other day, allowing a zero value. The results were very
interesting on my freebsd system. The delay in select seems to
have about a 10 msec granularity, and the smallest non-zero wait
is about 17-20 msec. Interesting.
-David Paigen
The patch:
*** forms.c Fri Dec 6 10:18:43 2002
--- forms.c.old Fri Dec 6 10:15:52 2002
***************
*** 2418,2430 ****
{
if (delta < 0)
delta = TIMER_RES;
-
- #ifdef _out_of_the_box_
- /* these lines prevented using */
- /* all of the idle cpu available */
else if (delta == 0)
delta = TIMER_RES / 10;
- #endif /* _out_of_the_box_ */
delta_msec = delta;
fl_context->idle_delta = delta;
--- 2418,2425 ----
The demo code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
int main( int argc, char **argv )
{
int tms;
struct timeval tv0;
struct timeval tv1;
struct timeval timeout;
/* changed this line here to show zero value */
for ( tms = 100; tms>=0; tms -= 5 ) {
timeout.tv_sec = tms / 1000;
timeout.tv_usec = ( tms % 1000 ) * 1000;
gettimeofday( &tv0, NULL );
select( 0, NULL, NULL, NULL, &timeout );
gettimeofday( &tv1, NULL );
fprintf( stderr, "timeout = %4d msec, %g msec elapsed\n",
tms,
( ( tv1.tv_sec - tv0.tv_sec ) +
( ( tv1.tv_usec - tv0.tv_usec ) * 1.0e-6 ) ) * 1000 );
}
exit( 0 );
}
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Fri Dec 06 2002 - 13:39:22 EST