Skip to content

Commit 3b08365

Browse files
committed
Improved plot script.
1 parent 1285ff7 commit 3b08365

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/plot-netperfmeter-results

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ set -eu
3232

3333
# ###### Usage ##############################################################
3434
usage () {
35-
echo >&2 "Usage: $0 config_file [-w|--ownfile] [-c|--colour|--color|-g|--greyscale|--grayscale|-b|--blackandwhite]"
35+
echo >&2 "Usage: $0 config_file [-w|--own-file] [-k|--keep-summaries] [-c|--colour|--color|-g|--greyscale|--grayscale|-b|--blackandwhite]"
3636
exit 1
3737
}
3838

@@ -41,21 +41,26 @@ usage () {
4141

4242
# ====== Handle arguments ===================================================
4343
GETOPT="$(PATH=/usr/local/bin:${PATH} which getopt)"
44-
options="$(${GETOPT} -o wcgbh --long ownfile,colour,color,greyscale,grayscale,blackandwhite,help -a -- "$@")"
44+
options="$(${GETOPT} -o wkcgbh --long own-file,ownfile,keep-summaries,colour,color,greyscale,grayscale,blackandwhite,help -a -- "$@")"
4545
# shellcheck disable=SC2181
4646
if [[ $? -ne 0 ]]; then
4747
usage
4848
fi
4949

50+
KEEP_SUMMARIES=0
5051
PLOT_COLOR_MODE="cmColor"
5152
PLOT_OWN_FILE="FALSE"
5253
eval set -- "${options}"
5354
while [ $# -gt 0 ] ; do
5455
case "$1" in
55-
-w | --ownfile)
56+
-w | --own-file | --ownfile)
5657
PLOT_OWN_FILE="TRUE"
5758
shift
5859
;;
60+
-k | --keep-summaries)
61+
KEEP_SUMMARIES=1
62+
shift
63+
;;
5964
-c | --colour | --color)
6065
PLOT_COLOR_MODE="cmColor"
6166
shift
@@ -127,11 +132,11 @@ done
127132

128133
SUMMARY_NAME="${OUTPUT_PREFIX}-summary.data.bz2"
129134
(
130-
echo "--values=\"\"${NAME_ACTIVE_NODE}\" 1\""
135+
echo -e "--values=\"\"${NAME_ACTIVE_NODE}\"\t1\""
131136
echo "--input=${VECTOR_ACTIVE_NODE}"
132-
echo "--values=\"\"${NAME_PASSIVE_NODE}\" 0\""
137+
echo -e "--values=\"\"${NAME_PASSIVE_NODE}\"\t0\""
133138
echo "--input=${VECTOR_PASSIVE_NODE}"
134-
) | ${COMBINESUMMARIES} "${SUMMARY_NAME}" "NodeName IsActive" --quiet --line-numbers
139+
) | ${COMBINESUMMARIES} "${SUMMARY_NAME}" $'NodeName\tIsActive' --separator $'\t' --line-numbers --quiet
135140

136141
FLOW_SUMMARY_NAME="${OUTPUT_PREFIX}-flows.data.bz2"
137142
(
@@ -147,13 +152,13 @@ FLOW_SUMMARY_NAME="${OUTPUT_PREFIX}-flows.data.bz2"
147152
eval activeVector="${activeVectorVar}"
148153
eval passiveVector="${passiveVectorVar}"
149154

150-
echo "--values=\"\"$flowDescription\" $i \"${NAME_ACTIVE_NODE}\" 1\""
155+
echo -e "--values=\"\"${flowDescription}\"\t$i\t\"${NAME_ACTIVE_NODE}\"\t1\""
151156
echo "--input=${activeVector}"
152-
echo "--values=\"\"$flowDescription\" $i \"${NAME_PASSIVE_NODE}\" 0\""
157+
echo -e "--values=\"\"${flowDescription}\"\t$i\t\"${NAME_PASSIVE_NODE}\"\t0\""
153158
echo "--input=${passiveVector}"
154-
i=$(($i+1))
159+
i=$((i+1))
155160
done
156-
) | ${COMBINESUMMARIES} "${FLOW_SUMMARY_NAME}" "FlowName FlowID NodeName IsActive" --quiet --line-numbers
161+
) | ${COMBINESUMMARIES} "${FLOW_SUMMARY_NAME}" $'FlowName\tFlowID\tNodeName\tIsActive' --separator $'\t' --line-numbers --quiet
157162

158163

159164
# ====== Plot the results ===================================================
@@ -192,4 +197,6 @@ R CMD BATCH --slave --vanilla \
192197

193198
# ====== Remove temporary files =============================================
194199
echo -e "\e[34mCleaning up ...\e[0m"
195-
rm -f "${SUMMARY_NAME}" "${FLOW_SUMMARY_NAME}"
200+
if [ ${KEEP_SUMMARIES} -eq 0 ] ; then
201+
rm -f "${SUMMARY_NAME}" "${FLOW_SUMMARY_NAME}"
202+
fi

0 commit comments

Comments
 (0)