[PlanetCCRMA] added: ALPHA version of Planet Core components for FC2
Steve Harris
S.W.Harris at ecs.soton.ac.uk
Sun Jun 20 11:32:01 PDT 2004
On Sun, Jun 20, 2004 at 11:04:01 -0700, Fernando Pablo Lopez-Lezcano wrote:
> > When I started it from qjackctl I got the printf storm xrun feedback
> > problem. Running it from the command line it was a bit better, but I
> > still had a problem with the "maximum time of something xxx.yyyy,
> > restarting" messages. My suscpicion is that theres more to it than that
> > though. I guess I should get on with that message patch incase to see if
> > it helps.
>
> Aw rats, I have to release a patched version of jack for fc2, there are
> some initializations missing in the realtime thread creation code that
> should not make a difference, but apparently do (ie: I explicitly set
> what should be the default). I think you are seeing the same problems I
> was seeing until I added that.
I've just made the patch, it did help, but it didnt seem to really fix the
problem, I've attched it just incase you want to try it, or I was doing
something wrong.
I ran it as root. The printf storms occured less frequently (basicly only
when it was starting up), but there was still a stream rather than a
couple of messages, so I think the problem is deeper.
My 100% guess, no knowledge, basic gut reaction is that the dead reconing
code is off, and theres actually nothing wrong, but the resets are causing
the storm.
- Steve
-------------- next part --------------
Index: jackd.c
===================================================================
RCS file: /cvsroot/jackit/jack/jackd/jackd.c,v
retrieving revision 1.36
diff -u -r1.36 jackd.c
--- jackd.c 14 Apr 2004 16:38:26 -0000 1.36
+++ jackd.c 20 Jun 2004 18:19:25 -0000
@@ -39,6 +39,8 @@
#include <jack/shm.h>
#include <jack/driver_parse.h>
+#include "message_buffer.h"
+
#ifdef USE_CAPABILITIES
#include <sys/stat.h>
@@ -169,6 +171,9 @@
sigaction (i, &action, 0);
}
}
+
+ /* start a thread to display messages from realtime threads */
+ mb_init("");
if (verbose) {
fprintf (stderr, "%d waiting for signals\n", getpid());
Index: engine.c
===================================================================
RCS file: /cvsroot/jackit/jack/jackd/engine.c,v
retrieving revision 1.91
diff -u -r1.91 engine.c
--- engine.c 4 May 2004 10:25:58 -0000 1.91
+++ engine.c 20 Jun 2004 18:19:26 -0000
@@ -58,6 +58,7 @@
#endif
#include "transengine.h"
+#include "message_buffer.h"
#define JACK_ERROR_WITH_SOCKETS 10000000
@@ -2371,9 +2372,9 @@
engine->spare_usecs &&
((WORK_SCALE * engine->spare_usecs) <= delayed_usecs)) {
- fprintf (stderr, "delay of %.3f usecs exceeds estimated spare"
- " time of %.3f; restart ...\n",
- delayed_usecs, WORK_SCALE * engine->spare_usecs);
+ MB_MESSAGE ("delay of %.3f usecs exceeds estimated spare "
+ "time of %.3f; restart ...\n",
+ delayed_usecs, WORK_SCALE * engine->spare_usecs);
if (++consecutive_excessive_delays > 10) {
jack_error ("too many consecutive interrupt delays "
Index: Makefile.am
===================================================================
RCS file: /cvsroot/jackit/jack/jackd/Makefile.am,v
retrieving revision 1.21
diff -u -r1.21 Makefile.am
--- Makefile.am 7 Apr 2004 04:52:58 -0000 1.21
+++ Makefile.am 20 Jun 2004 18:19:26 -0000
@@ -23,9 +23,9 @@
AM_CFLAGS = $(JACK_CFLAGS) -DJACK_LOCATION=\"$(bindir)\"
-jackd_SOURCES = jackd.c engine.c transengine.c
+jackd_SOURCES = jackd.c engine.c transengine.c message_buffer.c
jackd_LDADD = ../libjack/libjack.la $(CAP_LIBS) @OS_LDFLAGS@
-noinst_HEADERS = jack_md5.h md5.h md5_loc.h transengine.h
+noinst_HEADERS = jack_md5.h md5.h md5_loc.h transengine.h message_buffer.h
BUILT_SOURCES = jack_md5.h
-------------- next part --------------
/* message_buffer.h
This file is in the public domain.
*/
#ifndef MESSAGE_BUFFER_H
#define MESSAGE_BUFFER_H
#define MB_MESSAGE(fmt...) { \
char _m[256]; \
snprintf(_m, 255, fmt); \
add_message(_m); \
}
void mb_init(const char *prefix);
void add_message(const char *msg);
#endif
-------------- next part --------------
/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
/* message_buffer.c
This file is in the public domain.
*/
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <stdio.h>
#define BUFFERS 16 /* must be 2^n */
#define BUFFER_SIZE 256
static char buffer[BUFFERS][BUFFER_SIZE];
static const char *mb_prefix;
static unsigned int initialised = 0;
static unsigned int in_buffer = 0;
static unsigned int out_buffer = 0;
static pthread_t writer_thread;
void *mb_thread_func(void *arg);
void add_message(const char *msg)
{
strncpy(buffer[in_buffer], msg, BUFFER_SIZE - 1);
in_buffer = (in_buffer + 1) & (BUFFERS - 1);
}
void mb_init(const char *prefix)
{
if (initialised) {
return;
}
mb_prefix = prefix;
pthread_create(&writer_thread, NULL, &mb_thread_func, NULL);
initialised = 1;
}
void *mb_thread_func(void *arg)
{
while (1) {
while (out_buffer != in_buffer) {
fprintf(stderr, "%s%s", mb_prefix, buffer[out_buffer]);
out_buffer = (out_buffer + 1) & (BUFFERS - 1);
}
usleep(1000);
}
return NULL;
}
/* vi:set ts=8 sts=4 sw=4: */
More information about the PlanetCCRMA
mailing list