[Devel] Re: [PATCH 2/4] cr_tests/ptree1: count tasks accurately

Matt Helsley matthltc at us.ibm.com
Fri Feb 26 12:57:26 PST 2010


On Fri, Feb 26, 2010 at 01:51:52PM -0600, Nathan Lynch wrote:
> "ps aux |grep $TEST_CMD | wc -l" tends to also count the grep process.
> The test script already assumes pidof is available, so just use that.
> 
> Signed-off-by: Nathan Lynch <ntl at pobox.com>

Acked-by: Matt Helsley <matthltc at us.ibm.com>

> ---
>  process-tree/run-ptree1.sh |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/process-tree/run-ptree1.sh b/process-tree/run-ptree1.sh
> index 6d56a66..d0cefff 100755
> --- a/process-tree/run-ptree1.sh
> +++ b/process-tree/run-ptree1.sh
> @@ -174,7 +174,7 @@ while [ $cnt -lt 15 ]; do
>  	freezerdir=$freezermountpoint/$pid
>  	freeze_pid $pid
> 
> -	num_pids1=`ps aux |grep $TEST_CMD | wc -l`
> +	num_pids1=`pidof $TEST_CMD | wc -w`
> 
>  	create_fs_snapshot
> 
> @@ -196,7 +196,7 @@ while [ $cnt -lt 15 ]; do
> 
>  	sleep 3;
> 
> -	num_pids2=`ps aux |grep $TEST_CMD | wc -l`
> +	num_pids2=`pidof $TEST_CMD | wc -w`
>  	ps aux |grep $TEST_CMD >> $SCRIPT_LOG
>  	$ECHO "\t- num_pids1 $num_pids1, num_pids2 $num_pids2";
> 
> -- 
> 1.6.0.6
> 
> _______________________________________________
> Containers mailing list
> Containers at lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list