|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2012 IBM Corp. |
| 4 | + |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +set -x |
| 11 | + |
| 12 | +source $(echo $0 | sed -e "s/\(.*\/\)*.*/\1.\//g")/cb_common.sh |
| 13 | + |
| 14 | +LOAD_PROFILE=$1 |
| 15 | +LOAD_LEVEL=$2 |
| 16 | +LOAD_DURATION=$3 |
| 17 | +LOAD_ID=$4 |
| 18 | +SLA_RUNTIME_TARGETS=$5 |
| 19 | + |
| 20 | +if [[ -z "$LOAD_PROFILE" || -z "$LOAD_LEVEL" || -z "$LOAD_DURATION" || -z "$LOAD_ID" ]] |
| 21 | +then |
| 22 | + syslog_netcat "Usage: cb_unixbench.sh <load profile> <load level> <load duration> <load_id>" |
| 23 | + exit 1 |
| 24 | +fi |
| 25 | + |
| 26 | +UNIXBENCH_DIR="~/byte-unixbench/UnixBench" |
| 27 | +eval UNIXBENCH_DIR=${UNIXBENCH_DIR} |
| 28 | + |
| 29 | +UNIXBENCH_IP=`get_ips_from_role unixbench` |
| 30 | +update_app_errors 0 reset |
| 31 | + |
| 32 | +syslog_netcat "Benchmarking UnixBench SUT: UNIXBENCH=${UNIXBENCH_IP} with (default) Index tests." |
| 33 | + |
| 34 | +OUTPUT_FILE=$(mktemp) |
| 35 | +if [[ $LOAD_PROFILE == "test" ]] |
| 36 | +then |
| 37 | + execute_load_generator "cat ./test_output.txt" ${OUTPUT_FILE} |
| 38 | +else |
| 39 | + cd ${UNIXBENCH_DIR} |
| 40 | + execute_load_generator "./Run" ${OUTPUT_FILE} |
| 41 | + cd - |
| 42 | +fi |
| 43 | + |
| 44 | +NUM_CORES=`grep -P -m1 "CPUs? in system" ${OUTPUT_FILE} | cut -d' ' -f1` |
| 45 | + |
| 46 | +# --------------------- START Aggregate metrics -------------------------------- # |
| 47 | +TMP=$(mktemp) |
| 48 | +grep -m 1 -A 14 "System Benchmarks .* INDEX" ${OUTPUT_FILE} > $TMP |
| 49 | + |
| 50 | +# Dhrystone 2 using register variables |
| 51 | +DHRY_RESULT=$(grep "Dhrystone 2 using register variables" $TMP | awk '{print $(NF-1)}') |
| 52 | +DHRY_INDEX=$(grep "Dhrystone 2 using register variables" $TMP | awk '{print $NF}') |
| 53 | +# Double-Precision Whetstone |
| 54 | +WHET_RESULT=$(grep "Double-Precision Whetstone" $TMP | awk '{print $(NF-1)}') |
| 55 | +WHET_INDEX=$(grep "Double-Precision Whetstone" $TMP | awk '{print $NF}') |
| 56 | +# Execl Throughput |
| 57 | +EXECL_RESULT=$(grep "Execl Throughput" $TMP | awk '{print $(NF-1)}') |
| 58 | +EXECL_INDEX=$(grep "Execl Throughput" $TMP | awk '{print $NF}') |
| 59 | +# File Copy 1024 bufsize 2000 maxblocks |
| 60 | +FC1024_RESULT=$(grep "File Copy 1024 bufsize 2000 maxblocks" $TMP | awk '{print $(NF-1)}') |
| 61 | +FC1024_INDEX=$(grep "File Copy 1024 bufsize 2000 maxblocks" $TMP | awk '{print $NF}') |
| 62 | +# File Copy 256 bufsize 500 maxblocks |
| 63 | +FC256_RESULT=$(grep "File Copy 256 bufsize 500 maxblocks" $TMP | awk '{print $(NF-1)}') |
| 64 | +FC256_INDEX=$(grep "File Copy 256 bufsize 500 maxblocks" $TMP | awk '{print $NF}') |
| 65 | +# File Copy 4096 bufsize 8000 maxblocks |
| 66 | +FC4096_RESULT=$(grep "File Copy 4096 bufsize 8000 maxblocks" $TMP | awk '{print $(NF-1)}') |
| 67 | +FC4096_INDEX=$(grep "File Copy 4096 bufsize 8000 maxblocks" $TMP | awk '{print $NF}') |
| 68 | +# Pipe Throughput |
| 69 | +PIPE_RESULT=$(grep "Pipe Throughput" $TMP | awk '{print $(NF-1)}') |
| 70 | +PIPE_INDEX=$(grep "Pipe Throughput" $TMP | awk '{print $NF}') |
| 71 | +# Pipe-based Context Switching |
| 72 | +CTXT_RESULT=$(grep "Pipe-based Context Switching" $TMP | awk '{print $(NF-1)}') |
| 73 | +CTXT_INDEX=$(grep "Pipe-based Context Switching" $TMP | awk '{print $NF}') |
| 74 | +# Process Creation |
| 75 | +PROC_RESULT=$(grep "Process Creation" $TMP | awk '{print $(NF-1)}') |
| 76 | +PROC_INDEX=$(grep "Process Creation" $TMP | awk '{print $NF}') |
| 77 | +# Shell Scripts (1 concurrent) |
| 78 | +SH1_RESULT=$(grep "Shell Scripts (1 concurrent)" $TMP | awk '{print $(NF-1)}') |
| 79 | +SH1_INDEX=$(grep "Shell Scripts (1 concurrent)" $TMP | awk '{print $NF}') |
| 80 | +# Shell Scripts (8 concurrent) |
| 81 | +SH8_RESULT=$(grep "Shell Scripts (8 concurrent)" $TMP | awk '{print $(NF-1)}') |
| 82 | +SH8_INDEX=$(grep "Shell Scripts (8 concurrent)" $TMP | awk '{print $NF}') |
| 83 | +# System Call Overhead |
| 84 | +SYSO_RESULT=$(grep "System Call Overhead" $TMP | awk '{print $(NF-1)}') |
| 85 | +SYSO_INDEX=$(grep "System Call Overhead" $TMP | awk '{print $NF}') |
| 86 | +# System Benchmarks Index Score |
| 87 | +TOTAL_INDEX=$(grep "System Benchmarks Index Score" $TMP | awk '{print $NF}') |
| 88 | + |
| 89 | +# multi-core results (when available) |
| 90 | +NUM_RESULTS=`grep -c "System Benchmarks .* INDEX" ${OUTPUT_FILE}` |
| 91 | +if [ "$NUM_RESULTS" -gt 1 ] |
| 92 | +then |
| 93 | + TMP=$(mktemp) |
| 94 | + grep -m 2 -A 14 "System Benchmarks .* INDEX" ${OUTPUT_FILE} | tail -n 15 > $TMP |
| 95 | + |
| 96 | + # Dhrystone 2 using register variables |
| 97 | + MC_DHRY_RESULT=$(grep "Dhrystone 2 using register variables" $TMP | awk '{print $(NF-1)}') |
| 98 | + MC_DHRY_INDEX=$(grep "Dhrystone 2 using register variables" $TMP | awk '{print $NF}') |
| 99 | + # Double-Precision Whetstone |
| 100 | + MC_WHET_RESULT=$(grep "Double-Precision Whetstone" $TMP | awk '{print $(NF-1)}') |
| 101 | + MC_WHET_INDEX=$(grep "Double-Precision Whetstone" $TMP | awk '{print $NF}') |
| 102 | + # Execl Throughput |
| 103 | + MC_EXECL_RESULT=$(grep "Execl Throughput" $TMP | awk '{print $(NF-1)}') |
| 104 | + MC_EXECL_INDEX=$(grep "Execl Throughput" $TMP | awk '{print $NF}') |
| 105 | + # File Copy 1024 bufsize 2000 maxblocks |
| 106 | + MC_FC1024_RESULT=$(grep "File Copy 1024 bufsize 2000 maxblocks" $TMP | awk '{print $(NF-1)}') |
| 107 | + MC_FC1024_INDEX=$(grep "File Copy 1024 bufsize 2000 maxblocks" $TMP | awk '{print $NF}') |
| 108 | + # File Copy 256 bufsize 500 maxblocks |
| 109 | + MC_FC256_RESULT=$(grep "File Copy 256 bufsize 500 maxblocks" $TMP | awk '{print $(NF-1)}') |
| 110 | + MC_FC256_INDEX=$(grep "File Copy 256 bufsize 500 maxblocks" $TMP | awk '{print $NF}') |
| 111 | + # File Copy 4096 bufsize 8000 maxblocks |
| 112 | + MC_FC4096_RESULT=$(grep "File Copy 4096 bufsize 8000 maxblocks" $TMP | awk '{print $(NF-1)}') |
| 113 | + MC_FC4096_INDEX=$(grep "File Copy 4096 bufsize 8000 maxblocks" $TMP | awk '{print $NF}') |
| 114 | + # Pipe Throughput |
| 115 | + MC_PIPE_RESULT=$(grep "Pipe Throughput" $TMP | awk '{print $(NF-1)}') |
| 116 | + MC_PIPE_INDEX=$(grep "Pipe Throughput" $TMP | awk '{print $NF}') |
| 117 | + # Pipe-based Context Switching |
| 118 | + MC_CTXT_RESULT=$(grep "Pipe-based Context Switching" $TMP | awk '{print $(NF-1)}') |
| 119 | + MC_CTXT_INDEX=$(grep "Pipe-based Context Switching" $TMP | awk '{print $NF}') |
| 120 | + # Process Creation |
| 121 | + MC_PROC_RESULT=$(grep "Process Creation" $TMP | awk '{print $(NF-1)}') |
| 122 | + MC_PROC_INDEX=$(grep "Process Creation" $TMP | awk '{print $NF}') |
| 123 | + # Shell Scripts (1 concurrent) |
| 124 | + MC_SH1_RESULT=$(grep "Shell Scripts (1 concurrent)" $TMP | awk '{print $(NF-1)}') |
| 125 | + MC_SH1_INDEX=$(grep "Shell Scripts (1 concurrent)" $TMP | awk '{print $NF}') |
| 126 | + # Shell Scripts (8 concurrent) |
| 127 | + MC_SH8_RESULT=$(grep "Shell Scripts (8 concurrent)" $TMP | awk '{print $(NF-1)}') |
| 128 | + MC_SH8_INDEX=$(grep "Shell Scripts (8 concurrent)" $TMP | awk '{print $NF}') |
| 129 | + # System Call Overhead |
| 130 | + MC_SYSO_RESULT=$(grep "System Call Overhead" $TMP | awk '{print $(NF-1)}') |
| 131 | + MC_SYSO_INDEX=$(grep "System Call Overhead" $TMP | awk '{print $NF}') |
| 132 | + # System Benchmarks Index Score |
| 133 | + MC_TOTAL_INDEX=$(grep "System Benchmarks Index Score" $TMP | awk '{print $NF}') |
| 134 | +fi |
| 135 | +# ---------------------- END Aggregate metrics --------------------------------- # |
| 136 | + |
| 137 | +# --------------------- START Reporting metrics -------------------------------- # |
| 138 | +~/cb_report_app_metrics.py load_id:${LOAD_ID}:seqnum \ |
| 139 | +load_level:${LOAD_LEVEL}:load \ |
| 140 | +load_profile:${LOAD_PROFILE}:name \ |
| 141 | +load_duration:${LOAD_DURATION}:sec \ |
| 142 | +num_cores:${NUM_CORES}:num \ |
| 143 | +dhry_result:${DHRY_RESULT}:lps \ |
| 144 | +dhry_index:${DHRY_INDEX}:num \ |
| 145 | +whet_result:${WHET_RESULT}:MWIPS \ |
| 146 | +whet_index:${WHET_INDEX}:num \ |
| 147 | +execl_result:${EXECL_RESULT}:lps \ |
| 148 | +execl_index:${EXECL_INDEX}:num \ |
| 149 | +fc1024_result:${FC1024_RESULT}:KBPs \ |
| 150 | +fc1024_index:${FC1024_INDEX}:num \ |
| 151 | +fc256_result:${FC256_RESULT}:KBPs \ |
| 152 | +fc256_index:${FC256_INDEX}:num \ |
| 153 | +fc4096_result:${FC4096_RESULT}:KBPs \ |
| 154 | +fc4096_index:${FC4096_INDEX}:num \ |
| 155 | +pipe_result:${PIPE_RESULT}:lps \ |
| 156 | +pipe_index:${PIPE_INDEX}:num \ |
| 157 | +ctxt_result:${CTXT_RESULT}:lps \ |
| 158 | +ctxt_index:${CTXT_INDEX}:num \ |
| 159 | +proc_result:${PROC_RESULT}:lps \ |
| 160 | +proc_index:${PROC_INDEX}:num \ |
| 161 | +sh1_result:${SH1_RESULT}:lpm \ |
| 162 | +sh1_index:${SH1_INDEX}:num \ |
| 163 | +sh8_result:${SH8_RESULT}:lpm \ |
| 164 | +sh8_index:${SH8_INDEX}:num \ |
| 165 | +syso_result:${SYSO_RESULT}:lps \ |
| 166 | +syso_index:${SYSO_INDEX}:num \ |
| 167 | +total_index:${TOTAL_INDEX}:num \ |
| 168 | +mc_dhry_result:${MC_DHRY_RESULT}:lps \ |
| 169 | +mc_dhry_index:${MC_DHRY_INDEX}:num \ |
| 170 | +mc_whet_result:${MC_WHET_RESULT}:MWIPS \ |
| 171 | +mc_whet_index:${MC_WHET_INDEX}:num \ |
| 172 | +mc_execl_result:${MC_EXECL_RESULT}:lps \ |
| 173 | +mc_execl_index:${MC_EXECL_INDEX}:num \ |
| 174 | +mc_fc1024_result:${MC_FC1024_RESULT}:KBPs \ |
| 175 | +mc_fc1024_index:${MC_FC1024_INDEX}:num \ |
| 176 | +mc_fc256_result:${MC_FC256_RESULT}:KBPs \ |
| 177 | +mc_fc256_index:${MC_FC256_INDEX}:num \ |
| 178 | +mc_fc4096_result:${MC_FC4096_RESULT}:KBPs \ |
| 179 | +mc_fc4096_index:${MC_FC4096_INDEX}:num \ |
| 180 | +mc_pipe_result:${MC_PIPE_RESULT}:lps \ |
| 181 | +mc_pipe_index:${MC_PIPE_INDEX}:num \ |
| 182 | +mc_ctxt_result:${MC_CTXT_RESULT}:lps \ |
| 183 | +mc_ctxt_index:${MC_CTXT_INDEX}:num \ |
| 184 | +mc_proc_result:${MC_PROC_RESULT}:lps \ |
| 185 | +mc_proc_index:${MC_PROC_INDEX}:num \ |
| 186 | +mc_sh1_result:${MC_SH1_RESULT}:lpm \ |
| 187 | +mc_sh1_index:${MC_SH1_INDEX}:num \ |
| 188 | +mc_sh8_result:${MC_SH8_RESULT}:lpm \ |
| 189 | +mc_sh8_index:${MC_SH8_INDEX}:num \ |
| 190 | +mc_syso_result:${MC_SYSO_RESULT}:lps \ |
| 191 | +mc_syso_index:${MC_SYSO_INDEX}:num \ |
| 192 | +mc_total_index:${MC_TOTAL_INDEX}:num \ |
| 193 | +errors:$(update_app_errors):num \ |
| 194 | +completion_time:$(update_app_completiontime):sec \ |
| 195 | +quiescent_time:$(update_app_quiescent):sec\ |
| 196 | +${SLA_RUNTIME_TARGETS} |
| 197 | +# --------------------- END Reporting metrics -------------------------------- # |
| 198 | + |
| 199 | +rm ${OUTPUT_FILE} |
| 200 | + |
| 201 | +exit 0 |
0 commit comments