Bugfix: HA kill process recovery has a conflict
[yardstick.git] / yardstick / benchmark / scenarios / compute / computecapacity.bash
index 98d4b8f..d49638f 100644 (file)
@@ -9,13 +9,15 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-# Measure compute capacity and scale of a host
+# compute capacity and scale of a host
 
 set -e
 
 # run capacity test
 run_capacity()
 {
+    #parameter used for HT(Hyper-Thread) check
+    HT_Para=2
     # Number of CPUs
     CPU=$(grep 'physical id' /proc/cpuinfo | sort -u | wc -l)
     # Number of physical cores in a single CPU
@@ -25,12 +27,17 @@ run_capacity()
     # Number of logical cores
     THREAD=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
     # Total memory size
-    MEMORY=$(grep 'MemTotal' /proc/meminfo | sort -u)
-    ME=$(echo $MEMORY | awk '/ /{printf "%s %s", $2, $3}')
+    MEMORY=$(grep 'MemTotal' /proc/meminfo | sort -u | awk '{print $2}')
+
     # Cache size per CPU
-    CACHE=$(grep 'cache size' /proc/cpuinfo | sort -u)
-    CA=$(echo $CACHE | awk '/ /{printf "%s", $4}')
-    CACHES=$[$CA * $CPU]
+    CACHE=$(grep 'cache size' /proc/cpuinfo | sort -u | awk '{print $4}')
+    CACHES=$[$CACHE * $CPU]
+    HT_Value=$[$HT_Para * $CORES]
+    if [ $HT_Value -eq $THREAD ]; then
+        HT_OPEN=1
+    else
+        HT_OPEN=0
+    fi
 }
 
 # write the result to stdout in json format
@@ -40,8 +47,9 @@ output_json()
         \"Cpu_number\":\"$CPU\", \
         \"Core_number\":\"$CORES\", \
         \"Thread_number\":\"$THREAD\", \
-        \"Memory_size\": \"$ME\", \
-        \"Cache_size\": \"$CACHES KB\" \
+        \"Memory_size\": \"$MEMORY\", \
+        \"Cache_size\": \"$CACHES\", \
+        \"HT_Open\": \"$HT_OPEN\" \
     }"
 }