All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] Optimise grep action in power_management.
@ 2015-10-15  1:21 Yuan Sun
  2015-10-15  1:21 ` [LTP] [PATCH 2/2] Optimise grep action in cpuset_syscall_test Yuan Sun
  2015-10-27 16:35 ` [LTP] [PATCH 1/2] Optimise grep action in power_management Cyril Hrubis
  0 siblings, 2 replies; 7+ messages in thread
From: Yuan Sun @ 2015-10-15  1:21 UTC (permalink / raw)
  To: ltp

root@p1:~# time (grep siblings /proc/cpuinfo > /dev/null)
real	0m0.003s
user	0m0.001s
sys	0m0.002s
root@p1:~# time (cat /proc/cpuinfo | grep siblings > /dev/null)
real	0m0.004s
user	0m0.002s
sys	0m0.003s

Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
---
 testcases/kernel/power_management/pm_include.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/power_management/pm_include.sh b/testcases/kernel/power_management/pm_include.sh
index 366c914..807a5a8 100755
--- a/testcases/kernel/power_management/pm_include.sh
+++ b/testcases/kernel/power_management/pm_include.sh
@@ -87,8 +87,8 @@ get_supporting_govr() {
 }
 
 is_hyper_threaded() {
-	siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'`
-	cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'`
+	siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'`
+	cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq | cut -f2 -d':'`
 	[ $siblings -gt $cpu_cores ]; echo $?
 }
 
@@ -131,8 +131,8 @@ is_multi_socket() {
 }
 
 is_multi_core() {
-	siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'`
-	cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | cut -f2 -d':'`
+	siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'`
+	cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq | cut -f2 -d':'`
 	if [ $siblings -eq $cpu_cores ]; then
 		[ $cpu_cores -gt 1 ]; echo $?
 	else
@@ -142,8 +142,8 @@ is_multi_core() {
 }
 
 is_dual_core() {
-	siblings=`cat /proc/cpuinfo | grep siblings | uniq | cut -f2 -d':'`
-        cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | uniq \
+	siblings=`grep siblings /proc/cpuinfo | uniq | cut -f2 -d':'`
+        cpu_cores=`grep "cpu cores" /proc/cpuinfo | uniq \
 			| cut -f2 -d':'`
         if [ $siblings -eq $cpu_cores ]; then
                 [ $cpu_cores -eq 2 ]; echo $?
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-16 17:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15  1:21 [LTP] [PATCH 1/2] Optimise grep action in power_management Yuan Sun
2015-10-15  1:21 ` [LTP] [PATCH 2/2] Optimise grep action in cpuset_syscall_test Yuan Sun
2015-11-06  9:01   ` Jan Stancek
2015-11-16 16:37     ` Cyril Hrubis
2015-11-16 16:50       ` Jan Stancek
2015-11-16 17:10         ` Cyril Hrubis
2015-10-27 16:35 ` [LTP] [PATCH 1/2] Optimise grep action in power_management Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.