cpuctl_fj: replace ps by top to fix cpu usage's computation error
PATCH 1/1 cpuctl_fj: replace ps by top to fix cpu usage's computation error
Some abnormal messages outputted in my x86_64.
-------------------
pid 4622 cpu_usage 0cpuctl_test_fj 1 TFAIL : case19 FAIL
pid 4646 cpu_usage 0cpuctl_test_fj 1 TFAIL : case20 FAIL
pid 4670 cpu_usage 63cpuctl_test_fj 1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works. Maybe we should replace 'ps' by 'top' in get_cpu_usage().
By the way, I increased the admissible range of cpu usage in case21() because it jumps out range of 44-56 sometimes.
My patch works now:
-------------------
pid 20277 cpu_usage 97cpuctl_test_fj 1 TPASS : case19 PASS
pid 20307 cpu_usage 99cpuctl_test_fj 1 TPASS : case20 PASS
pid 20336 cpu_usage 55
pid 20336 cpu_usage 53
pid 20336 cpu_usage 55
pid 20336 cpu_usage 57
pid 20336 cpu_usage 55
pid 20336 cpu_usage 55
pid 20336 cpu_usage 55
pid 20336 cpu_usage 55
pid 20336 cpu_usage 57
pid 20336 cpu_usage 53cpuctl_test_fj 1 TPASS : case21 PASS
-------------------
---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh +5 -2
@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }' + top=($(top -b -n 1 -p $1 | tail -2 | head -1)) + top=${top[8]} + top=`echo $top | awk -F "." '{print $1}'` + echo "$top" } kill_all_pid()
@@ -627,7 +630,7 @@ case21() do cpu_usage=$(get_cpu_usage $pid) echo "pid $pid cpu_usage $cpu_usage" - expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 > /dev/null 2>&1 + expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 > /dev/null 2>&1 ret=$? : $(( top_times+=1 )) done
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 51 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works. Maybe we should replace 'ps' by 'top' in get_cpu_usage().
By the way, I increased the admissible range of cpu usage incase21()because it jumps out range of 44-56 sometimes.My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Signed-off-by Shi Weihua <[email protected]>---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +4
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }' + top=($(top -b -n 1 -p $1 | tail -2 | head -1)) + top=${top[8]} + top=`echo $top | awk -F "." '{print $1}'` + echo "$top" } kill_all_pid()@@ -627,7 +630,7 @@ case21()
Quoted 8 lines
do
cpu_usage=$(get_cpu_usage $pid)
echo "pid $pidcpu_usage$cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 >/dev/null2>&1
+ expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 >/dev/null2>&1 ret=$?
: $(( top_times+=1 ))
done
Could you add a set -x to the top of the script so we can see the
output please? ps --version would be helpful too..
Thanks,
-Garrett
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 50 lines · Garrett Cooper
Quoted 49 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works. Maybe we should replace 'ps' by 'top' inget_cpu_usage().
By the way, I increased the admissible range of cpu usage incase21()because it jumps out range of 44-56 sometimes.My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Signed-off-by Shi Weihua <[email protected]>---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +4
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }' + top=($(top -b -n 1 -p $1 | tail -2 | head -1)) + top=${top[8]} + top=`echo $top | awk -F "." '{print $1}'` + echo "$top" }
Quoted 13 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 case21() · line 636
Quoted 10 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +1
-1kill_all_pid()@@ -627,7 +630,7 @@ case21() do cpu_usage=$(get_cpu_usage $pid) echo "pid $pid cpu_usage $cpu_usage" - expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 > /dev/null 2>&1 + expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 > /dev/null 2>&1 ret=$? : $(( top_times+=1 )) doneCould you add a set -x to the top of the script so we can see the
output please? ps --version would be helpful too..
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup
+ '[' -e /dev/cpuctl ']'
+ mkdir -p /dev/cpuctl
+ mount -t cgroup -o cpu cpuctl /dev/cpuctl
+ case19
+ mkdir /dev/cpuctl/1
++ creat_process
++ taskset -p 1 17790
++ cat /dev/zero
++ echo 17790
+ pid=17790
++ creat_process
++ taskset -p 1 17793
++ cat /dev/zero
++ echo 17793
+ pid_other=17793
+ echo 2000000000
+ echo 17790
++ get_cpu_usage 17790
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17790
+++ head -1
+++ tail -2
++ top=97.8
+++ echo 97.8
+++ awk -F . '{print $1}'
++ top=97
++ echo 97
+ cpu_usage=97
+ echo 'pid 17790 cpu_usage 97'
pid 17790 cpu_usage 97
+ kill -9 17790 17793
+ expr 96 '<' 97 '&' 97 '<' 103
+ return 0
+ cleanup
+ mount
+ grep /dev/cpuctl
+ find /dev/cpuctl -type d
+ sort
+ sed -n '2,$p'
+ tac
+ read tmpdir
+ read tmppid
+ rmdir /dev/cpuctl/1
+ read tmpdir
+ umount /dev/cpuctl
+ rmdir /dev/cpuctl
+ tst_resm TPASS 'case19 PASS'cpuctl_test_fj 1 TPASS : case19 PASS
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup
+ '[' -e /dev/cpuctl ']'
+ mkdir -p /dev/cpuctl
+ mount -t cgroup -o cpu cpuctl /dev/cpuctl
+ case20
+ mkdir /dev/cpuctl/1
++ creat_process
++ taskset -p 1 17819
++ cat /dev/zero
++ echo 17819
+ pid=17819
++ creat_process
++ taskset -p 1 17822
++ cat /dev/zero
++ echo 17822
+ pid_other=17822
+ echo 20000000000
+ echo 17819
++ get_cpu_usage 17819
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17819
+++ head -1
+++ tail -2
++ top=97.8
+++ echo 97.8
+++ awk -F . '{print $1}'
++ top=97
++ echo 97
+ cpu_usage=97
+ echo 'pid 17819 cpu_usage 97'
pid 17819 cpu_usage 97
+ kill -9 17819 17822
+ expr 96 '<' 97 '&' 97 '<' 103
+ return 0
+ cleanup
+ mount
+ grep /dev/cpuctl
+ find /dev/cpuctl -type d
+ sort
+ sed -n '2,$p'
+ tac
+ read tmpdir
+ read tmppid
+ rmdir /dev/cpuctl/1
+ read tmpdir
+ umount /dev/cpuctl
+ rmdir /dev/cpuctl
+ tst_resm TPASS 'case20 PASS'cpuctl_test_fj 1 TPASS : case20 PASS
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup
+ '[' -e /dev/cpuctl ']'
+ mkdir -p /dev/cpuctl
+ mount -t cgroup -o cpu cpuctl /dev/cpuctl
+ case21
+ mkdir /dev/cpuctl/1 /dev/cpuctl/1/2
++ creat_process
++ taskset -p 1 17848
++ cat /dev/zero
++ echo 17848
+ pid=17848
+ echo 17848
+ loop_pid=17850
+ sleep 10
+ true
+ creat_process
+ taskset -p 1 17852
+ cat /dev/zero
+ echo 17852
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17855
+ cat /dev/zero
+ echo 17855
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17858
+ cat /dev/zero
+ echo 17858
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17861
+ cat /dev/zero
+ echo 17861
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17864
+ cat /dev/zero
+ echo 17864
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17867
+ cat /dev/zero
+ echo 17867
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17870
+ cat /dev/zero
+ echo 17870
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17873
+ cat /dev/zero
+ echo 17873
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17876
+ cat /dev/zero
+ echo 17876
+ sleep 1
+ true
+ creat_process
+ taskset -p 1 17879
+ cat /dev/zero
+ echo 17879
+ sleep 1
+ ret=0
+ top_times=0
+ '[' 0 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
+ true
+ creat_process
+ taskset -p 1 17887
+ cat /dev/zero
+ echo 17887
+ sleep 1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 1
+ '[' 1 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 2
+ '[' 2 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
+ true
+ creat_process
+ taskset -p 1 17908
+ cat /dev/zero
+ echo 17908
+ sleep 1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 3
+ '[' 3 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
++ top=47.9
+++ echo 47.9
+++ awk -F . '{print $1}'
++ top=47
++ echo 47
+ cpu_usage=47
+ echo 'pid 17848 cpu_usage 47'
pid 17848 cpu_usage 47
+ expr 40 '<' 47 '&' 47 '<' 60
+ ret=0
+ : 4
+ '[' 4 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
+ true
+ creat_process
+ taskset -p 1 17929
+ cat /dev/zero
+ echo 17929
+ sleep 1
++ top=47.9
+++ echo 47.9
+++ awk -F . '{print $1}'
++ top=47
++ echo 47
+ cpu_usage=47
+ echo 'pid 17848 cpu_usage 47'
pid 17848 cpu_usage 47
+ expr 40 '<' 47 '&' 47 '<' 60
+ ret=0
+ : 5
+ '[' 5 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 6
+ '[' 6 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
+ true
+ creat_process
+ taskset -p 1 17950
+ cat /dev/zero
+ echo 17950
+ sleep 1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 7
+ '[' 7 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 8
+ '[' 8 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
+ true
+ creat_process
+ taskset -p 1 17971
+ cat /dev/zero
+ echo 17971
+ sleep 1
++ top=49.9
+++ echo 49.9
+++ awk -F . '{print $1}'
++ top=49
++ echo 49
+ cpu_usage=49
+ echo 'pid 17848 cpu_usage 49'
pid 17848 cpu_usage 49
+ expr 40 '<' 49 '&' 49 '<' 60
+ ret=0
+ : 9
+ '[' 9 -lt 10 -a 0 = 0 ']'
++ get_cpu_usage 17848
++ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) +++ top -b -n 1 -p 17848
+++ tail -2
+++ head -1
++ top=51.9
+++ echo 51.9
+++ awk -F . '{print $1}'
++ top=51
++ echo 51
+ cpu_usage=51
+ echo 'pid 17848 cpu_usage 51'
pid 17848 cpu_usage 51
+ expr 40 '<' 51 '&' 51 '<' 60
+ ret=0
+ : 10
+ '[' 10 -lt 10 -a 0 = 0 ']'
+ kill -9 17848 17850
+ wait 17848 17850
+ sleep 2
+ kill_all_pid
+ sleep 2
+ return 0
+ cleanup
+ mount
+ grep /dev/cpuctl
+ find /dev/cpuctl -type d
+ sort
+ sed -n '2,$p'
+ tac
+ read tmpdir
+ read tmppid
+ rmdir /dev/cpuctl/1/2
+ read tmpdir
+ read tmppid
+ rmdir /dev/cpuctl/1
+ read tmpdir
+ umount /dev/cpuctl
+ rmdir /dev/cpuctl
+ tst_resm TPASS 'case21 PASS'cpuctl_test_fj 1 TPASS : case21 PASS
---------------------------------------------------------
# bash --version GNU bash, version 4.0.28(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 65 lines · On Wednesday 06 January 2010 10:47:34 Shi Weihua wrote:
Quoted 50 lines · Garrett Cooper
Quoted 49 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works. Maybe we should replace 'ps' by 'top' inget_cpu_usage().
By the way, I increased the admissible range of cpu usage incase21()because it jumps out range of 44-56 sometimes.My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Signed-off-by Shi Weihua <[email protected]>---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +4
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }' + top=($(top -b -n 1 -p $1 | tail -2 | head -1)) + top=${top[8]} + top=`echo $top | awk -F "." '{print $1}'` + echo "$top" }Quoted 13 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 case21() · line 636
Quoted 10 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +1
-1kill_all_pid()@@ -627,7 +630,7 @@ case21() do cpu_usage=$(get_cpu_usage $pid) echo "pid $pid cpu_usage $cpu_usage" - expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 > /dev/null 2>&1 + expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 > /dev/null 2>&1 ret=$? : $(( top_times+=1 )) doneCould you add a set -x to the top of the script so we can see the
output please? ps --version would be helpful too..
Quoted 4 lines
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup
[ ... snip ... ]
I believe Garrett Cooper meant to send the trace output of the original script (the one with ps).
However, I'm not sure about the awk program there - particularly:
sub(/(\.[[:digit:]])*$/, "", $2)
should probably be
sub(/\.[[:digit:]]*$/, "", $2)
(without the group). Not sure if this can actually cause what you see.
Also, I think we could simplify it a bit further, to something like this:
get_cpu_usage()
{
ps -p $1 -o pcpu= | awk -F "." '{print $1}'
}
Please, tell me what do you think about it.
Regards
Jiri Palecek
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 85 lines · Jiri Palecek
Quoted 65 lines · On Wednesday 06 January 2010 10:47:34 Shi Weihua wrote:
Quoted 50 lines · Garrett Cooper
Quoted 49 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works. Maybe we should replace 'ps' by 'top' in get_cpu_usage().
By the way, I increased the admissible range of cpu usage incase21()because it jumps out range of 44-56 sometimes.My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Signed-off-by Shi Weihua <[email protected]>---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +4
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }' + top=($(top -b -n 1 -p $1 | tail -2 | head -1)) + top=${top[8]} + top=`echo $top | awk -F "." '{print $1}'` + echo "$top" }Quoted 13 lines
Quoted 10 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 15:40:40.000000000 +0800 +0
-0kill_all_pid()@@ -627,7 +630,7 @@ case21()do
cpu_usage=$(get_cpu_usage $pid)
echo "pid $pidcpu_usage$cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 >/dev/null2>&1
+ expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 >/dev/null2>&1 ret=$?
: $(( top_times+=1 ))
doneCould you add a set -x to the top of the script so we can see the output please? ps --version would be helpful too..
Quoted 4 lines
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup[ ... snip ... ]
I believe Garrett Cooper meant to send the trace output of the original script (the one with ps).
However, I'm not sure about the awk program there - particularly:
sub(/(\.[[:digit:]])*$/, "", $2)should probably be
sub(/\.[[:digit:]]*$/, "", $2)(without the group). Not sure if this can actually cause what you see.
Quoted 8 lines
Also, I think we could simplify it a bit further, to something like this:
get_cpu_usage()
{
ps -p $1 -o pcpu= | awk -F "." '{print $1}'
}Please, tell me what do you think about it.
Actually he gave me what I needed (forgot to reply because I
didn't star the email); I'm pretty sure that your observation is
correct: we shouldn't be extracting \. unless we're actually going to use it, so the ellipses [\(\)] can be removed.
Are we using just the major' number, or are we using the minor'
number in the cpu usage?
Thanks,
-Garrett
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 100 lines · Garrett Cooper
Quoted 99 lines · Jiri Palecek
Quoted 72 lines · On Wednesday 06 January 2010 10:47:34 Shi Weihua wrote:
Quoted 1 line · Garrett Cooper
On Tue, Jan 5, 2010 at 8:58 PM, Shi Weihua <[email protected]>
Quoted 11 lines · wrote:
Quoted 11 lines
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunatelyit works.
Quoted 2 lines
Quoted 2 lines
Maybe we should replace 'ps' by 'top' in get_cpu_usage(). By the way, I increased the admissible range of cpu usage in
case21()Quoted 21 lines
Quoted 21 lines
because it jumps out range of 44-56 sometimes.
My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Quoted 3 lines
Quoted 3 lines
Signed-off-by Shi Weihua <[email protected]>---
---
ltp-full-20091231/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh2009-11-16 15:40:40.000000000 +0800Quoted 1 line
Quoted 1 line
+++
ltp-full-20091231.new/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh2010-01-06 12:36:32.000000000 +0800Quoted 5 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh creat_process() · line 88
Quoted 5 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh +0
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" {
sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'Quoted 6 lines
Quoted 6 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh +4
-0+ top=($(top -b -n 1 -p $1 | tail -2 | head -1)) + top=${top[8]} + top=`echo $top | awk -F "." '{print $1}'` + echo "$top" }Quoted 6 lines
Quoted 6 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh +0
-0kill_all_pid()@@ -627,7 +630,7 @@ case21()do
cpu_usage=$(get_cpu_usage $pid)
echo "pid $pidcpu_usage$cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 >
/dev/null2>&1Quoted 1 line
Quoted 1 line
+ expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 >
/dev/null2>&1Quoted 4 lines
Quoted 3 lines
ret=$?
: $(( top_times+=1 ))
doneQuoted 7 lines
Quoted 2 lines
Could you add a set -x to the top of the script so we can see the output please? ps --version would be helpful too..
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup[ ... snip ... ]
I believe Garrett Cooper meant to send the trace output of the original script (the one with ps).
However, I'm not sure about the awk program there - particularly:
sub(/(\.[[:digit:]])*$/, "", $2)should probably be
sub(/\.[[:digit:]]*$/, "", $2)(without the group). Not sure if this can actually cause what you see.
Also, I think we could simplify it a bit further, to something like this:
Quoted 8 lines
Quoted 6 lines
get_cpu_usage()
{
ps -p $1 -o pcpu= | awk -F "." '{print $1}'
}Please, tell me what do you think about it.
Actually he gave me what I needed (forgot to reply because I
Yes, but it doesn't cast much light on the problem that it didn't work for Shi Weihua in the first place.
Quoted 5 lines
didn't star the email); I'm pretty sure that your observation is
correct: we shouldn't be extracting \. unless we're actually going to use it, so the ellipses [\(\)] can be removed.
Are we using just themajor' number, or are we using theminor'
number in the cpu usage?
You mean integral and fractional part? I guess the integral part only.
Regards
Jiri Palecek
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
2010/1/22 Jiří Paleček <[email protected]>:
Quoted 115 lines
Quoted 100 lines · Garrett Cooper
Quoted 99 lines · Jiri Palecek
Quoted 75 lines · On Wednesday 06 January 2010 10:47:34 Shi Weihua wrote:
Quoted 57 lines · Garrett Cooper
Quoted 55 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works.
Maybe we should replace 'ps' by 'top' in get_cpu_usage(). By the way, I increased the admissible range of cpu usage incase21()because it jumps out range of 44-56 sometimes.My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Signed-off-by Shi Weihua <[email protected]>---
---ltp-full-20091231/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh2009-11-16 15:40:40.000000000 +0800 +++ ltp-full-20091231.new/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh +0
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" {
sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
+ top=($(top -b -n 1 -p $1 | tail -2 | head -1))
+ top=${top[8]}
+ top=echo $top | awk -F "." '{print $1}'
+ echo "$top"
}Quoted 15 lines
Quoted 4 lines
kill_all_pid()
(quoted diff) +0
-0@@ -627,7 +630,7 @@ case21()do
cpu_usage=$(get_cpu_usage $pid)Quoted 8 lines
echo "pid $pid
cpu_usage$cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 >/dev/null2>&1
+ expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 >/dev/null2>&1
ret=$?
: $(( top_times+=1 ))
doneCould you add a set -x to the top of the script so we can see the output please? ps --version would be helpful too..
Quoted 4 lines
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup[ ... snip ... ]
I believe Garrett Cooper meant to send the trace output of the original script (the one with ps).
However, I'm not sure about the awk program there - particularly:
sub(/(\.[[:digit:]])*$/, "", $2)should probably be
sub(/\.[[:digit:]]*$/, "", $2)(without the group). Not sure if this can actually cause what you see.
Also, I think we could simplify it a bit further, to something like this:
Quoted 8 lines
Quoted 6 lines
get_cpu_usage()
{
ps -p $1 -o pcpu= | awk -F "." '{print $1}'
}Please, tell me what do you think about it.
Actually he gave me what I needed (forgot to reply because I
Yes, but it doesn't cast much light on the problem that it didn't work for Shi Weihua in the first place.
Quoted 7 lines
Quoted 5 lines
didn't star the email); I'm pretty sure that your observation is
correct: we shouldn't be extracting \. unless we're actually going to use it, so the ellipses [\(\)] can be removed.
Are we using just themajor' number, or are we using theminor' number in the cpu usage?You mean integral and fractional part? I guess the integral part only.
Does expr(1) do float point comparisons (this is where the issue was coming from I think...)?
gcooper@optimus ~ $ expr 0 \< 42.0 \& 42.0 \< 100 0
gcooper@optimus ~ $ expr 0.0 \< 42.0 \& 42.0 \< 100.0 0
I checked in a copy based on your suggestion Jiri so folks would hit this issue, but I'm curious as to why integers are the only things supported by expr(1) when comparing ranges.
Thanks,
-Garrett
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
2010/1/23 Garrett Cooper <[email protected]>:
Quoted 127 lines
2010/1/22 Jiří Paleček <[email protected]>:
Quoted 115 lines
Quoted 100 lines · Garrett Cooper
Quoted 99 lines · Jiri Palecek
Quoted 75 lines · On Wednesday 06 January 2010 10:47:34 Shi Weihua wrote:
Quoted 57 lines · Garrett Cooper
Quoted 55 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunately it works.
Maybe we should replace 'ps' by 'top' in get_cpu_usage(). By the way, I increased the admissible range of cpu usage incase21()because it jumps out range of 44-56 sometimes.My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Signed-off-by Shi Weihua <[email protected]>---
---ltp-full-20091231/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh2009-11-16 15:40:40.000000000 +0800 +++ ltp-full-20091231.new/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2010-01-06 12:36:32.000000000 +0800(quoted diff) +0
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" {
sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
+ top=($(top -b -n 1 -p $1 | tail -2 | head -1))
+ top=${top[8]}
+ top=echo $top | awk -F "." '{print $1}'
+ echo "$top"
}Quoted 15 lines
Quoted 4 lines
kill_all_pid()
(quoted diff) +0
-0@@ -627,7 +630,7 @@ case21()do
cpu_usage=$(get_cpu_usage $pid)Quoted 8 lines
echo "pid $pid
cpu_usage$cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 >/dev/null2>&1
+ expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 >/dev/null2>&1
ret=$?
: $(( top_times+=1 ))
doneCould you add a set -x to the top of the script so we can see the output please? ps --version would be helpful too..
Quoted 4 lines
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup[ ... snip ... ]
I believe Garrett Cooper meant to send the trace output of the original script (the one with ps).
However, I'm not sure about the awk program there - particularly:
sub(/(\.[[:digit:]])*$/, "", $2)should probably be
sub(/\.[[:digit:]]*$/, "", $2)(without the group). Not sure if this can actually cause what you see.
Also, I think we could simplify it a bit further, to something like this:
Quoted 8 lines
Quoted 6 lines
get_cpu_usage()
{
ps -p $1 -o pcpu= | awk -F "." '{print $1}'
}Please, tell me what do you think about it.
Actually he gave me what I needed (forgot to reply because I
Yes, but it doesn't cast much light on the problem that it didn't work for Shi Weihua in the first place.
Quoted 7 lines
Quoted 5 lines
didn't star the email); I'm pretty sure that your observation is
correct: we shouldn't be extracting \. unless we're actually going to use it, so the ellipses [\(\)] can be removed.
Are we using just themajor' number, or are we using theminor' number in the cpu usage?You mean integral and fractional part? I guess the integral part only.
Does expr(1) do float point comparisons (this is where the issue was coming from I think...)?
Quoted 6 lines
gcooper@optimus ~ $ expr 0 \< 42.0 \& 42.0 \< 100 0
gcooper@optimus ~ $ expr 0.0 \< 42.0 \& 42.0 \< 100.0 0I checked in a copy based on your suggestion Jiri so folks would hit
s/would/wouldn't/
Quoted 2 lines
this issue, but I'm curious as to why integers are the only things supported by expr(1) when comparing ranges.
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 135 lines · Garrett Cooper
2010/1/22 Jiří Paleček <[email protected]>:
Quoted 123 lines
Quoted 107 lines · Garrett Cooper
Quoted 106 lines · Jiri Palecek
Quoted 77 lines · On Wednesday 06 January 2010 10:47:34 Shi Weihua wrote:
Quoted 13 lines · Garrett Cooper
Quoted 11 lines · Shi Weihua
Some abnormal messages outputted in my
x86_64.
-------------------
pid 4622cpu_usage0cpuctl_test_fj1 TFAIL : case19 FAIL
pid 4646cpu_usage0cpuctl_test_fj1 TFAIL : case20 FAIL
pid 4670cpu_usage63cpuctl_test_fj1 TFAIL : case21 FAIL
-------------------
I think cpu usage's computation error occured.
So I tried to use the oldest arithmetic of cpu usage, fortunatelyit
Quoted 3 lines
Quoted 3 lines
works.
Maybe we should replace 'ps' by 'top' in get_cpu_usage(). By the way, I increased the admissible range of cpu usage in
case21()Quoted 21 lines
Quoted 21 lines
because it jumps out range of 44-56 sometimes.
My patch works now:
-------------------
pid 20277cpu_usage97cpuctl_test_fj1 TPASS : case19 PASS
pid 20307cpu_usage99cpuctl_test_fj1 TPASS : case20 PASS
pid 20336cpu_usage55
pid 20336cpu_usage53
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage55
pid 20336cpu_usage57
pid 20336cpu_usage53cpuctl_test_fj1 TPASS : case21 PASS
-------------------Quoted 4 lines
Quoted 4 lines
Signed-off-by Shi Weihua <[email protected]>---
---
ltp-full-20091231/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.shQuoted 3 lines
Quoted 3 lines
2009-11-16 15:40:40.000000000 +0800+++
ltp-full-20091231.new/testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.shQuoted 13 lines
Quoted 13 lines
2010-01-06 12:36:32.000000000 +0800(quoted diff) +0
-1@@ -85,7 +85,10 @@ creat_process() get_cpu_usage() { - ps -eo 'pid,pcpu' | awk '$1 == "'$1'" {
sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
+ top=($(top -b -n 1 -p $1 | tail -2 | head -1))
+ top=${top[8]}
+ top=echo $top | awk -F "." '{print $1}'
+ echo "$top"
}Quoted 14 lines
Quoted 4 lines
kill_all_pid()
(quoted diff) +0
-0@@ -627,7 +630,7 @@ case21()do
cpu_usage=$(get_cpu_usage $pid)Quoted 8 lines
echo "pid $pid
cpu_usage$cpu_usage"
- expr 44 \< "$cpu_usage" \& "$cpu_usage" \< 56 >/dev/null2>&1
+ expr 40 \< "$cpu_usage" \& "$cpu_usage" \< 60 >/dev/null2>&1
ret=$?
: $(( top_times+=1 ))
doneCould you add a set -x to the top of the script so we can see
Quoted 7 lines
the
Quoted 1 line
output please? ps --version would be helpful too..
I wish it can help you.
--------------------- sh -x -----------------------------
+ for i in '$(seq 1 $TST_TOTAL)'
+ setup[ ... snip ... ]
I believe Garrett Cooper meant to send the trace output of the original
script (the one with ps).However, I'm not sure about the awk program there - particularly:
sub(/(\.[[:digit:]])*$/, "", $2)should probably be
sub(/\.[[:digit:]]*$/, "", $2)(without the group). Not sure if this can actually cause what you see.
Also, I think we could simplify it a bit further, to something like this:
Quoted 8 lines
Quoted 6 lines
get_cpu_usage()
{
ps -p $1 -o pcpu= | awk -F "." '{print $1}'
}Please, tell me what do you think about it.
Actually he gave me what I needed (forgot to reply because I
Yes, but it doesn't cast much light on the problem that it didn't work for
Shi Weihua in the first place.Quoted 7 lines
Quoted 5 lines
didn't star the email); I'm pretty sure that your observation is
correct: we shouldn't be extracting \. unless we're actually going to use it, so the ellipses [\(\)] can be removed.
Are we using just themajor' number, or are we using theminor' number in the cpu usage?You mean integral and fractional part? I guess the integral part only.
Does expr(1) do float point comparisons (this is where the issue was coming from I think...)?
Quoted 8 lines
gcooper@optimus ~ $ expr 0 \< 42.0 \& 42.0 \< 100 0
gcooper@optimus ~ $ expr 0.0 \< 42.0 \& 42.0 \< 100.0 0I checked in a copy based on your suggestion Jiri so folks would hit this issue, but I'm curious as to why integers are the only things supported by expr(1) when comparing ranges.
Obviously, only integers are supported by expr. That's the way it is.
Not that I think we (or this test) actually need floating point numbers - we can happily use integral approximations when testing against interval 40-60. But Shi Weihua's mail indicated that he gets 0 (zero) from that function, so I guess it's because top gives different data from ps (which is actually true - ps gives average cpu % over the whole lifetime of the process, top over the last five seconds). Maybe this needs changing?
Regards
Jiri Palecek
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list