tools/jprof/jprofsig

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #!/bin/sh
     2 #
     3 # This Source Code Form is subject to the terms of the Mozilla Public
     4 # License, v. 2.0. If a copy of the MPL was not distributed with this
     5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7 #
     8 # Find Mozilla PID and send it a signal, to be used
     9 # with the jprof tool.
    10 #
    12 jpsignal_usage() {
    13   echo "Usage: jprofsig [start|stop]"
    14   exit 1
    15 }
    17 if [ $# != 1 ]; then
    18   echo "Wrong number of arguments."
    19   jpsignal_usage
    20 fi
    22 jpsignal_arg="$1"
    24 # Find & print mozilla PID
    25 tmpmoz=`ps aux | grep mozilla-bin | head -1 | awk '{ print $2 }'`
    26 echo "Mozilla PID = $tmpmoz"
    28 # See how we were called.
    29 case "$jpsignal_arg" in
    30   start)
    31     if [ "$JP_REALTIME" = 1 ]; then
    32       kill -ALRM $tmpmoz
    33     else
    34       # Normal, non-realtime mode.
    35       kill -PROF $tmpmoz
    36     fi
    37     ;;
    38   stop)
    39     kill -USR1 $tmpmoz
    40     ;;
    41   *)
    42     jpsignal_usage
    43     exit 1
    44 esac
    46 exit 0

mercurial