This is almost certainly a dupe, but I don't have a record of it:
I built on mac os x 10.4.6 and got warnings about the heartbeat frequency, e.g.,
./mix > test6.out 1.374983 secs elapsed cpu time heartbeat frequency = 48.72787518100223 Hz *** possible problem: expected heartbeat frequency = 100. Hz
Reporting, as a just-in-case.
Brian
Afficher les réponses par date
On 23-May-06, at 12:31 AM, brian wrote:
This is almost certainly a dupe, but I don't have a record of it:
I built on mac os x 10.4.6 and got warnings about the heartbeat frequency, e.g.,
./mix > test6.out 1.374983 secs elapsed cpu time heartbeat frequency = 48.72787518100223 Hz *** possible problem: expected heartbeat frequency = 100. Hz
Reporting, as a just-in-case.
Brian
Brian, I've had this problem on Mac OS X for quite some time. As far as I can tell this is a bug in Mac OS X ITIMER_VIRTUAL timer handling on multiprocessors. If you have the "Processor Prefs" tool, try disabling one of the two processors, and try the test again. You will see that the heartbeat frequency is close to 100 as it should. I have sent a bug report to Apple more than a year ago, but never got a reply, so I did not pursue it longer. Perhaps someone on this list can hassle Apple into fixing this. Below is a small C program that exhibits the problem.
Marc
/* * File: "timer.c". * * This program was written by Marc Feeley (feeley@iro.umontreal.ca). * * This program exhibits a problem with the ITIMER_VIRTUAL timer on * Mac OS X running on a multiprocessor. It seems that some of the signals * that should be generated are lost. If the ITIMER_REAL timer is used * instead, the signals are generated in a timely manner. Moreover, when * the ITIMER_VIRTUAL timer is used, it seems that generating events (such * as moving the mouse, pressing the shift key on the keyboard, etc) causes the * signals to be generated for a moment. Below is a trace of the execution. * The program should write one V on stdout every 1/10 of a second. * * $ gcc -DUSE_ITIMER_VIRTUAL timer.c * $ time ./a.out * VVVV^C * * real 0m9.489s * user 0m9.470s * sys 0m0.010s * $ gcc -DUSE_ITIMER_REAL timer.c * $ time ./a.out * RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR^C * * real 0m6.737s * user 0m6.590s * sys 0m0.000s * $ uname -a * Darwin neo.iro.umontreal.ca 8.6.1 Darwin Kernel Version 8.6.1: Tue Mar 7 16:55:45 PST 2006; root:xnu-792.9.22.obj~1/RELEASE_I386 i386 i386 */
#include <sys/time.h> #include <signal.h> #include <stdio.h> #include <unistd.h>
void heartbeat_interrupt_handler (int sig) { #ifdef USE_ITIMER_REAL write (STDOUT_FILENO, "R", 1); #else write (STDOUT_FILENO, "V", 1); #endif }
int main (int argc, char *argv[]) { struct itimerval tv; int secs = 0; int usecs = 100000;
#ifdef USE_ITIMER_REAL int HEARTBEAT_ITIMER = ITIMER_REAL; int SIG = SIGALRM; #else int HEARTBEAT_ITIMER = ITIMER_VIRTUAL; int SIG = SIGVTALRM; #endif
struct sigaction act; act.sa_handler = heartbeat_interrupt_handler; act.sa_flags = 0; #ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT; #endif sigemptyset (&act.sa_mask); sigaction (SIG, &act, 0);
tv.it_interval.tv_sec = secs; tv.it_interval.tv_usec = usecs; tv.it_value.tv_sec = secs; tv.it_value.tv_usec = usecs; setitimer (HEARTBEAT_ITIMER, &tv, 0); getitimer (HEARTBEAT_ITIMER, &tv);
for (;;) { /* keep CPU 100% busy */ }
return 0; }