Hi everybody!

I would like to know how to schedule an operation (write to file) with
below-second frequency, any advise?

My strategy up to now has been to check, in the main loop, how many time
passed from the last operation's occurence. Given that variable now is
updated in every loop iteration, my code looks like this:

struct timeval now, lastOp;
gettime(&now);
gettime(&lastOp);
...
//babel main loop
while(1) {
gettime(&now);
if (microSecDiff(&now, &lastOp)>499000) {
doThatOperation();
gettime(&lastOp);
}
...
}

However, running a Babel instance on my laptop, I notice that the main loop
is performed with a strange frequency...sometimes approx 1Hz sometimes
slower. Consequently, if I perform a check of how many microseconds are
passed from the last loop iteration I miss the below-second deadline that I
desire.

The main loop frequency that I notice is standard or anomalous? What I
notice is related to the "clock monotonicity" enforced with the use of
gettime()? Or I have this problem just because my laptop has a bad clock?

Any hint would be very much appreciated :)

Thank you and regards,

Lorenzo
_______________________________________________
Babel-users mailing list
Babel-users@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/babel-users

Reply via email to