lkml.org 
[lkml]   [2003]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateTue, 11 Feb 2003 02:10:54 -0800
FromAndrew Morton <>
SubjectRe: [BENCHMARK] 2.5.60 with contest
Con Kolivas <ckolivas@yahoo.com.au> wrote:
>
> interestingly dbench_load wouldnt give me a number because dbench never
> quite started - a whole swag of processes visible but not doing anything

Signal problems...

What dbench is doing is:

- Install a SIGCONT handler
- fork N times, children drop into a pause()
- parent does kill(0, SIGCONT);

It appears that the SIGCONT is not causing the children to drop out of the
pause().

Changing it to SIGINT makes it work.

The tarball is at http://samba.org/ftp/tridge/dbench/dbench-2.0.tar.gz

Here's the relevant snippet:

static double create_procs(int nprocs, void (*fn)(struct child_struct * ))
{
int i, status;
int synccount;
signal(SIGCONT, sigcont);

start_timer();

synccount = 0;

if (nprocs < 1) {
fprintf(stderr,
"create %d procs? you must be kidding.\n",
nprocs);
return 1;
}
children = shm_setup(sizeof(struct child_struct)*nprocs);
if (!children) {
printf("Failed to setup shared memory\n");
return end_timer();
}
memset(children, 0, sizeof(*children)*nprocs);

for (i=0;i<nprocs;i++) {
children[i].id = i;
children[i].nprocs = nprocs;
}
for (i=0;i<nprocs;i++) {
if (fork() == 0) {
setbuffer(stdout, NULL, 0);
nb_setup(&children[i]);
children[i].status = getpid();
pause();
fn(&children[i]);
_exit(0);
}
}
do {
synccount = 0;
for (i=0;i<nprocs;i++) {
if (children[i].status) synccount++;
}
if (synccount == nprocs) break;
sleep(1);
} while (end_timer() < 30);
if (synccount != nprocs) {
printf("FAILED TO START %d CLIENTS (started %d)\n", nprocs, synccount);
return end_timer();
}
start_timer();
kill(0, SIGCONT);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:33    [from the cache]
©2003-2010