tools/jprof/jprofsig

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/jprof/jprofsig	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +
    1.10 +#
    1.11 +# Find Mozilla PID and send it a signal, to be used
    1.12 +# with the jprof tool.
    1.13 +#
    1.14 +
    1.15 +jpsignal_usage() {
    1.16 +  echo "Usage: jprofsig [start|stop]"
    1.17 +  exit 1
    1.18 +}
    1.19 +
    1.20 +if [ $# != 1 ]; then
    1.21 +  echo "Wrong number of arguments."
    1.22 +  jpsignal_usage
    1.23 +fi
    1.24 +
    1.25 +jpsignal_arg="$1"
    1.26 +
    1.27 +# Find & print mozilla PID
    1.28 +tmpmoz=`ps aux | grep mozilla-bin | head -1 | awk '{ print $2 }'`
    1.29 +echo "Mozilla PID = $tmpmoz"
    1.30 +
    1.31 +# See how we were called.
    1.32 +case "$jpsignal_arg" in
    1.33 +  start)
    1.34 +    if [ "$JP_REALTIME" = 1 ]; then
    1.35 +      kill -ALRM $tmpmoz
    1.36 +    else
    1.37 +      # Normal, non-realtime mode.
    1.38 +      kill -PROF $tmpmoz
    1.39 +    fi
    1.40 +    ;;
    1.41 +  stop)
    1.42 +    kill -USR1 $tmpmoz
    1.43 +    ;;
    1.44 +  *)
    1.45 +    jpsignal_usage
    1.46 +    exit 1
    1.47 +esac
    1.48 +
    1.49 +exit 0

mercurial