memleak: Print error message if fewer than 2 arguments are supplied.

This commit is contained in:
tastytea 2021-12-05 20:56:09 +01:00
parent a5c0238573
commit 670bfe4311
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 13 additions and 7 deletions

View File

@ -3,21 +3,27 @@
# smem -P '^myprogram' -t | tail -n1 \
# | awk '{print "USS:", $4; print "PSS:",$5; print "RSS:",$6; print "SWP:",$3;}' \
# | sed "s/:/ $(date --iso-8601=minutes)/" >> mem-myprogram.data
#
# Arguments: <program name> <time of first data point> [width] [height]
# Example usage: ./memory-consumption-over-time.gp myprogram 2021-12-05T08:42
if (ARGC > 0) {
if (ARGC < 2) {
printerr "You probably want to supply the program name ", \
"and the time of first data point. ", \
"See the header of this script for more information."
}
myprog='unknown'
if (ARGC >= 1) {
myprog = ARG1
} else {
myprog='unknown'
}
infile=sprintf('mem-%s.data', myprog)
mytimefmt = "%Y-%m-%dT%H:%M"
if (ARGC > 1) {
mystarttime = strptime(mytimefmt, "1970-01-01T00:00")
if (ARGC >= 2) {
mystarttime = strptime(mytimefmt, ARG2)
} else {
mystarttime = strptime(mytimefmt, "1970-01-01T00:00")
}
}
set title sprintf('%s memory consumption over time', myprog)