From: John L. <mov...@us...> - 2002-12-03 03:18:33
|
Update of /cvsroot/oprofile/oprofile/utils In directory sc8-pr-cvs1:/tmp/cvs-serv18283/utils Modified Files: opcontrol Log Message: some --reset/--save fixes Index: opcontrol =================================================================== RCS file: /cvsroot/oprofile/oprofile/utils/opcontrol,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- opcontrol 3 Dec 2002 02:56:29 -0000 1.4 +++ opcontrol 3 Dec 2002 03:18:28 -0000 1.5 @@ -397,12 +397,11 @@ --reset) DUMP=yes - STOP=yes - KILL_DAEMON=yes RESET=yes ;; --save) + error_if_empty $arg $val DUMP=yes SAVE_SESSION=yes SAVE_NAME=$val @@ -543,10 +542,10 @@ } do_kill_daemon() { - if test -f /var/lib/oprofile/lock; then + if test -f "$LOCK_FILE"; then echo "Stopping profiling and killing daemon" if test $KERNEL_SUPPORT = "yes"; then - kill -TERM `cat /var/lib/oprofile/lock` + kill -TERM `cat $LOCK_FILE` else echo 1 >/proc/sys/dev/oprofile/dump_stop fi @@ -692,7 +691,7 @@ # start the daemon do_start() { - if test -f $LOCK_FILE; then + if test -f "$LOCK_FILE"; then kill -s 0 `cat $LOCK_FILE` 2>/dev/null if test "$?" -eq 0; then echo "oprofiled appears to be running already." >&2 @@ -752,6 +751,14 @@ fi } +#tell daemon to re-open the sample files +hup_daemon() { + if test -f "$LOCK_FILE"; then + echo "Signalling daemon..." + kill -HUP `cat $LOCK_FILE` + fi +} + #move all the sample files to a sample directory do_save_session () { SAVE_DIR="${SAMPLES_DIR}${SAVE_NAME}" @@ -777,6 +784,8 @@ echo "session $SAVE_DIR already exists\n" >& 2 exit 1 fi + + hup_daemon } #remove all the sample files, but leave the session directories alone @@ -788,6 +797,8 @@ rm ${SAMPLES_DIR}${f} fi done + + hup_daemon } do_deinit() { @@ -827,6 +838,12 @@ do_dump fi + #FIXME this is a hack :( + if test "$SAVE_SESSION" = "yes" -o "$RESET" = "yes"; then + echo "Dumping stored data ..." + sleep 2 + fi + if test "$SAVE_SESSION" = "yes"; then do_save_session fi |