From a071447aa574455acd1dbd1a1cab5bc1c53a4346 Mon Sep 17 00:00:00 2001 From: Jonathan Abrahams Date: Wed, 14 Sep 2016 12:37:07 -0400 Subject: SERVER-26044 Evergreen thread usage monitor should not send a signal to resmoke.py - code cleanup. --- etc/evergreen.yml | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'etc') diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 8b633595331..51863498e1f 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -231,34 +231,36 @@ functions: script: | proc_list="(bsondump|java|lein|mongo|python|_test$|_test\.exe$)" if [ "Windows_NT" = "$OS" ]; then - get_pids() {\ - proc_pids=$(tasklist /fo:csv | awk -F'","' '{x=$1; gsub("\"","",x);\ - print $2, x}' | grep -i -E $1 | cut -f1 -d ' ');\ + get_pids() { + proc_pids=$(tasklist /fo:csv | + awk -F'","' '{x=$1; gsub("\"","",x); print $2, x}' | + grep -i -E $1 | + cut -f1 -d ' '); } - get_process_info() {\ - proc_name="";\ - proc_info=$(wmic process where "ProcessId=\"$1\"" get "Name,ProcessId,ThreadCount" /format:csv 2> /dev/null | grep $1);\ - if [ ! -z $proc_info ]; then\ - proc_name=$(echo $proc_info | cut -f2 -d ',');\ + get_process_info() { + proc_name=""; + proc_info=$(wmic process where "ProcessId=\"$1\"" get "Name,ProcessId,ThreadCount" /format:csv 2> /dev/null | grep $1); + if [ ! -z $proc_info ]; then + proc_name=$(echo $proc_info | cut -f2 -d ','); proc_threads=$(echo $proc_info | cut -f4 -d ','); - fi;\ - } + fi; + } else get_pids() { proc_pids=$(pgrep $1); } - get_process_info() {\ - proc_name=$(ps -p $1 -o comm=);\ + get_process_info() { + proc_name=$(ps -p $1 -o comm=); # prstat is available on Solaris - if [ ! -z $(which prstat 2> /dev/null) ]; then\ - proc_threads=$(prstat -p $1 1 1 | grep $1 | cut -f2 -d "/");\ + if [ ! -z $(which prstat 2> /dev/null) ]; then + proc_threads=$(prstat -p $1 1 1 | grep $1 | cut -f2 -d "/"); # /proc is available on Linux platforms - elif [ -f /proc/$1/status ]; then\ - proc_threads=$($sudo grep Threads /proc/$1/status | sed "s/\s//g" | cut -f2 -d ":");\ - else\ - proc_threads=$(ps -AM $1 | grep -vc PID);\ - fi;\ + elif [ -f /proc/$1/status ]; then + ${set_sudo} + proc_threads=$($sudo grep Threads /proc/$1/status | sed "s/\s//g" | cut -f2 -d ":"); + else + proc_threads=$(ps -AM $1 | grep -vc PID); + fi; } fi - ${set_sudo} while [ 1 ] do get_pids $proc_list -- cgit v1.2.1