Bug 1853320 [wpt PR 41940] - [FLEDGE] Split up runs of /trusted-scoring-signals.https...
[gecko.git] / tools / jprof / jprofsig
blob02226fc4b69921d3543da5d22d02ca87fcd34a43
1 #!/bin/sh
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/.
8 # Find Mozilla PID and send it a signal, to be used
9 # with the jprof tool.
12 jpsignal_usage() {
13 echo "Usage: jprofsig [start|stop]"
14 exit 1
17 if [ $# != 1 ]; then
18 echo "Wrong number of arguments."
19 jpsignal_usage
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
38 stop)
39 kill -USR1 $tmpmoz
42 jpsignal_usage
43 exit 1
44 esac
46 exit 0