Skip to content

Commit dd4cbc6

Browse files
committed
Improved scripts and manpage.
1 parent 1008a83 commit dd4cbc6

File tree

3 files changed

+27
-43
lines changed

3 files changed

+27
-43
lines changed

src/plot-netperfmeter-results

Lines changed: 11 additions & 17 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|--own-file] [-k|--keep-summaries] [-c|--colour|--color|-g|--greyscale|--grayscale|-b|--blackandwhite]"
35+
echo >&2 "Usage: $0 config_file [-w|--own-file] [-k|--keep-summaries] [-p|--per-flow-plots]"
3636
exit 1
3737
}
3838

@@ -41,14 +41,14 @@ usage () {
4141

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

5050
KEEP_SUMMARIES=0
51-
PLOT_COLOR_MODE="cmColor"
51+
PER_FLOW_PLOTS=0
5252
PLOT_OWN_FILE="FALSE"
5353
eval set -- "${options}"
5454
while [ $# -gt 0 ] ; do
@@ -61,16 +61,8 @@ while [ $# -gt 0 ] ; do
6161
KEEP_SUMMARIES=1
6262
shift
6363
;;
64-
-c | --colour | --color)
65-
PLOT_COLOR_MODE="cmColor"
66-
shift
67-
;;
68-
-g | --greyscale | --grayscale)
69-
PLOT_COLOR_MODE="cmGrayScale"
70-
shift
71-
;;
72-
-b | ---blackandwhite)
73-
PLOT_COLOR_MODE="cmBlackAndWhite"
64+
-p | --per-flow-plots)
65+
PER_FLOW_PLOTS=1
7466
shift
7567
;;
7668
-h | --help)
@@ -98,6 +90,7 @@ echo -e "\e[34mChecking vector files ...\e[0m"
9890
VECTOR_ACTIVE_NODE=""
9991
VECTOR_PASSIVE_NODE=""
10092
NUM_FLOWS=0
93+
# shellcheck disable=SC1090
10194
. "${CONFIG_FILE}"
10295
if [ "${VECTOR_PASSIVE_NODE}" == "" ] || [ "${VECTOR_ACTIVE_NODE}" == "" ] || [ ${NUM_FLOWS} -lt 1 ] ; then
10396
echo >&2 "ERROR: Bad vector file configuration!"
@@ -111,6 +104,7 @@ if [ ! -e "${VECTOR_PASSIVE_NODE}" ] ; then
111104
echo >&2 "ERROR: Vector file ${VECTOR_ACTIVE_NODE} of passive node not found!"
112105
exit 1
113106
fi
107+
# shellcheck disable=SC2001
114108
OUTPUT_PREFIX="$(echo "${CONFIG_FILE}" | sed -e "s/.config$//g")"
115109

116110
echo "Configuration:"
@@ -169,16 +163,16 @@ SEARCH_PATHS=". /usr/share/netperfmeter /usr/local/share/netperfmeter"
169163
PLOT_PROGRAM_DIR=""
170164
PLOT_PROGRAM_SCRIPT="plot-netperfmeter-results.R"
171165
for searchPath in ${SEARCH_PATHS} ; do
172-
if [ -e "${searchPath}/${PLOT_PROGRAM_SCRIPT}" ] && [ -e "${searchPath}/plotter.R" ] ; then
166+
if [ -e "${searchPath}/${PLOT_PROGRAM_SCRIPT}" ] ; then
173167
PLOT_PROGRAM_DIR=${searchPath}
174168
break
175169
fi
176170
done
177171
if [ "${PLOT_PROGRAM_DIR}" = "" ] ; then
178-
echo >&2 "ERROR: Cannot find ${PLOT_PROGRAM_SCRIPT} and plotter.R!"
172+
echo >&2 "ERROR: Cannot find ${PLOT_PROGRAM_SCRIPT}!"
179173
exit 1
180174
elif [ "${PLOT_PROGRAM_DIR}" = "." ] ; then
181-
echo "Using ${PLOT_PROGRAM_SCRIPT} and plotter.R from ${searchPath}."
175+
echo "Using ${PLOT_PROGRAM_SCRIPT} from ${searchPath}."
182176
fi
183177

184178

@@ -190,7 +184,7 @@ R CMD BATCH --slave --vanilla \
190184
summaryFile=\"${SUMMARY_NAME}\"
191185
flowSummaryFile=\"${FLOW_SUMMARY_NAME}\"
192186
pdfFilePrefix=\"${OUTPUT_PREFIX}\"
193-
plotColorMode=${PLOT_COLOR_MODE}
187+
perFlowPlots=${PER_FLOW_PLOTS}
194188
plotOwnFile=${PLOT_OWN_FILE}" \
195189
"${PLOT_PROGRAM_DIR}/${PLOT_PROGRAM_SCRIPT}" /dev/stdout
196190

src/plot-netperfmeter-results.1

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
.\" Homepage: https://www.nntb.no/~dreibh/netperfmeter/
2727
.\"
2828
.\" ###### Setup ############################################################
29-
.Dd November 14, 2025
29+
.Dd November 17, 2025
3030
.Dt plot-netperfmeter-results 1
3131
.Os plot-netperfmeter-results
3232
.\" ###### Name #############################################################
@@ -40,9 +40,7 @@ config_name
4040
.br
4141
.Op Fl w | Fl Fl ownfile
4242
.br
43-
.Op Fl c | Fl Fl colour | Fl Fl color
44-
.Op Fl g | Fl Fl greyscale | Fl Fl grayscale
45-
.Op Fl b | Fl Fl blackandwhite
43+
.Op Fl p | Fl Fl per-flow-plots
4644
.Nm plot-netperfmeter-results
4745
.Op Fl h | Fl Fl help
4846
.\" ###### Description ######################################################
@@ -58,12 +56,8 @@ The following arguments have to be provided:
5856
The name of the config file written by NetPerfMeter.
5957
.It Fl w | Fl Fl ownfile
6058
Plot a separate PDF file for each page.
61-
.It Fl c | Fl Fl colour | Fl Fl color
62-
Create colour plot.
63-
.It Fl g | Fl Fl greyscale | Fl Fl grayscale
64-
Create grey-scale plot.
65-
.It Fl b | Fl Fl blackandwhite
66-
Create black and white plot.
59+
.It Fl p | Fl Fl per-flow-plots
60+
Also generate separate plots for each flow.
6761
.It Fl h | Fl Fl help
6862
Prints command-line parameters.
6963
.El
@@ -72,7 +66,9 @@ Prints command-line parameters.
7266
Some plot-netperfmeter-results usage examples:
7367
.Bl -tag -width indent
7468
.It plot-netperfmeter-results output.config
75-
Plot the vector file output.vec.bz2. The resulting PDF file will be named output.pdf.
69+
Plot the results given by output.config. The resulting PDF file will be named output.pdf.
70+
.It plot-netperfmeter-results output.config --per-flow-plots
71+
Plot the results given by output.config, including per-flow plots. The resulting PDF file will be named output.pdf.
7672
.It plot-netperfmeter-results output.config --ownfile
7773
Plot the results given by output.config. For each page, a separate PDF file is written. The resulting PDF files will be named output-<title>.pdf, where <title> corresponds to the page title.
7874
.It plot-netperfmeter-results --help

src/plot-netperfmeter-results.R

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ plotQoSStatistics <- function(inputData, flowSummaryData, nodeName) {
349349
# ###########################################################################
350350

351351
# ###### Default Settings ###################################################
352-
plotColorMode <- 2 # == cmColor
353352
plotOwnFile <- TRUE
354353
plotFontFamily <- "Helvetica"
355354
plotPointSize <- 12
@@ -361,23 +360,16 @@ plotPaper <- "A4r" # Use "special" for manual values! Or: A4/A4r.
361360
# ###### Command-Line Arguments #############################################
362361
args <- commandArgs(TRUE)
363362
# print(args)
364-
365363
for(i in 1:length(args)) {
366364
eval(parse(text=args[i]))
367-
if(i == 2) {
368-
# ------ Include plotting functions -----------------------------------
369-
# The first parameter must set "programDirectory". The further
370-
# parameters may use constants defined in plotter.R. Therefore, plotter.R
371-
# must be included before!
372-
source(paste(sep="", programDirectory, "/plotter.R"))
373-
}
374365
}
375366

376-
# cat(sep="", "programDirectory=", programDirectory, "\n")
377-
# cat(sep="", "configFile=", configFile, "\n")
378-
# cat(sep="", "summaryFile=", summaryFile, "\n")
379-
# cat(sep="", "pdfFilePrefix=", pdfFilePrefix, "\n")
380-
# cat(sep="", "plotOwnFile=", plotOwnFile, "\n")
367+
# cat(sep="", "programDirectory=", programDirectory, "\n")
368+
# cat(sep="", "configFile=", configFile, "\n")
369+
# cat(sep="", "summaryFile=", summaryFile, "\n")
370+
# cat(sep="", "pdfFilePrefix=", pdfFilePrefix, "\n")
371+
# cat(sep="", "perFlowPlots=", perFlowPlots, "\n")
372+
# cat(sep="", "plotOwnFile=", plotOwnFile, "\n")
381373

382374

383375
# ====== Load input data ====================================================
@@ -408,7 +400,9 @@ plotNodeStats(data, NAME_PASSIVE_NODE)
408400

409401

410402
# ====== Flow QoS Statistics ================================================
411-
# plotQoSStatistics(summaryData, flowSummaryData)
403+
if(perFlowPlots == 1) {
404+
plotQoSStatistics(summaryData, flowSummaryData)
405+
}
412406

413407

414408
# ====== Finish PDF file ====================================================

0 commit comments

Comments
 (0)