cpuctl_fj: fix syntax error of awk
PATCH 1/1 cpuctl_fj: fix syntax error of awk
cpuctl_test_fj's case19-22 failed on my x86_64 box.
----------------------------------------------
awk: print $9
awk: ^ syntax error
pid 8077 cpu_usagecpuctl_test_fj 1 TFAIL : case19 FAIL
awk: print $9
awk: ^ syntax error
pid 8104 cpu_usagecpuctl_test_fj 1 TFAIL : case20 FAIL
awk: print $9
awk: ^ syntax error
pid 8131 cpu_usagecpuctl_test_fj 1 TFAIL : case21 FAIL
awk: print $9
awk: ^ syntax error
pid 8193 cpu_usagecpuctl_test_fj 1 TFAIL : case22 FAIL
----------------------------------------------
I fixed the syntax error of awk in the following patch.
---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh +1 -1
@@ -85,7 +85,7 @@ creat_process() get_cpu_usage() { - top -b -n 1 -p $1 | tail -2 | head -1 | awk 'print $9' | awk -F "." '{print $1}' + top -b -n 1 -p $1 | tail -2 | head -1 | awk '{print $9}' | awk -F "." '{print $1}' } kill_all_pid()
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Quoted 26 lines · Shi Weihua
cpuctl_test_fj's case19-22 failed on my
x86_64box.
----------------------------------------------
awk: print $9
awk: ^ syntax error
pid 8077cpu_usagecpuctl_test_fj1 TFAIL : case19 FAIL
awk: print $9
awk: ^ syntax error
pid 8104cpu_usagecpuctl_test_fj1 TFAIL : case20 FAIL
awk: print $9
awk: ^ syntax error
pid 8131cpu_usagecpuctl_test_fj1 TFAIL : case21 FAIL
awk: print $9
awk: ^ syntax error
pid 8193cpu_usagecpuctl_test_fj1 TFAIL : case22 FAIL
----------------------------------------------
I fixed the syntax error of awk in the following patch.Signed-off-by Shi Weihua <[email protected]>---
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 04:51:22.000000000 -0500 creat_process() · line 91
Quoted 8 lines
testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-16 04:51:22.000000000 -0500 renamed from testcases/kernel/controllers/cpuctl_fj/run_cpuctl_test_fj.sh 2009-11-02 04:07:14.000000000 -0500 +1
-1@@ -85,7 +85,7 @@ creat_process() get_cpu_usage() { - top -b -n 1 -p $1 | tail -2 | head -1 | awk 'print $9' | awk -F "." '{print $1}' + top -b -n 1 -p $1 | tail -2 | head -1 | awk '{print $9}' | awk -F "." '{print $1}' } kill_all_pid()
That code's just ugly anyhow. We shouldn't have to call top, when we can call ps to do the same thing...
ps -eo 'pid,pcpu' | awk '$1 == "'$1'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
Example:
ps -eo 'pid,pcpu' | awk '$1 == "1" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
0
ps -eo 'pid,pcpu' | awk '$1 == "'$(pidof xfce4-session)'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
0
ps -eo 'pid,pcpu' | awk '$1 == "'$(pidof vfork)'" { sub(/(\.[[:digit:]])*$/, "", $2); print $2 }'
99
That's been committed to CVS.
Thanks for the report!
-Garrett
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list