From: John L. <mov...@us...> - 2002-07-12 18:30:40
|
Update of /cvsroot/oprofile/oprofile/dae In directory usw-pr-cvs1:/tmp/cvs-serv2343/dae Modified Files: oprofiled.c Log Message: Use a state variable { STOPPED, STOPPING, RUNNING } instead of three confusing bools. Alex, Bob, this is another interface change, see libop/op_interface.h Index: oprofiled.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/dae/oprofiled.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- oprofiled.c 4 Jul 2002 23:23:39 -0000 1.88 +++ oprofiled.c 12 Jul 2002 18:30:36 -0000 1.89 @@ -487,17 +487,14 @@ * (EAGAIN is returned). * * This will not livelock as the profiler has been partially - * shut down by now. Multiple stops from user-space can cause - * more reads of 0 size, so we cater for that. Technically this - * would be a livelock, but it requires root to send stops constantly - * and never lose the race. */ + * shut down by now. + */ while (1) { count = op_read_device(devfd, buf, size); - if (count < 0 && errno == EAGAIN) { + if (count < 0 && errno == EAGAIN) break; - } else if (count > 0) { - opd_do_samples(buf); - } + verbprintf("Shutting down, state %d\n", buf->state); + opd_do_samples(buf); } } @@ -523,8 +520,9 @@ while (count < 0) { count = op_read_device(devfd, buf, size); - /* if count == 0, that means we need to stop ! */ - if (count == 0) { + /* request to stop arrived */ + if (buf->state == STOPPING) { + verbprintf("Shutting down by request.\n"); opd_shutdown(buf, size, nbuf, nsize); return; } @@ -610,7 +608,7 @@ opd_stats[OPD_DUMP_COUNT]++; - for (i=0; i < opd_buf->count; i++) { + for (i = 0; i < opd_buf->count; i++) { verbprintf("%.6u: EIP: 0x%.8x pid: %.6d count: %.6d\n", i, buffer[i].eip, buffer[i].pid, buffer[i].count); |