[Devel] [PATCH 2/4] cr_tests/ptree1: count tasks accurately
Nathan Lynch
ntl at pobox.com
Fri Feb 26 11:51:52 PST 2010
"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>
---
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
More information about the Devel
mailing list