~marcoil/glcompbench/glproxy-flavor

« back to all changes in this revision

Viewing changes to src/gl-composite-benchmark

  • Committer: Alexandros Frantzis
  • Date: 2011-12-05 12:20:15 UTC
  • Revision ID: alexandros.frantzis@linaro.org-20111205122015-olr5173v5gb4pkx3
GlCompositeBenchmark: Use the first 'sh' child to get the WID.

This avoids a race condition, where sometimes we capture another, wrong xterm
child process (eg utempter).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
pids=""
25
25
wids=""
26
26
 
27
 
get_first_child_of_pid()
 
27
get_first_sh_child_of_pid()
28
28
{
29
 
    ps ax -o pid,ppid | awk -v PID=$1 '$2 == PID { print $1; exit }'
 
29
    ps ax -o pid,ppid,comm | awk -v PID=$1 '$2 == PID && $3 == "sh" { print $1; exit }'
30
30
}
31
31
 
32
32
get_wid_from_pid()
40
40
    _child_pid=
41
41
    while [ -z "$_wid" ]; do
42
42
        if [ -z "$_child_pid" ]; then
43
 
            _child_pid=$(get_first_child_of_pid $1)
 
43
            _child_pid=$(get_first_sh_child_of_pid $1)
44
44
        fi
45
45
        if [ -n "$_child_pid" ]; then
46
46
            _wid=$(get_wid_from_pid $_child_pid)