Alien-Judy
view release on metacpan or search on metacpan
src/judy-1.0.5/test/jbgraph view on Meta::CPAN
#!/bin/sh
# THIS SCRIPT IS A "WRAPPER" FOR: gnuplot
#
# - The data used is in "gnuplot" format to compare and contrast
# - information for analysis in the Judy project. Circa: 05/12/2000.
# Author: Bob Gobeille, # Original functionality.
# Jer/ Eberhard, # Ongoing maintenance, added functionality.
RCS_SCRIPT='
# @(#) $Revision: 2.24 $ $Source: /judy/src/apps/benchmark/jbgraph $
'
# SET VERBOSE TO QUIET, SILENT (DEFAULT):
#
# - then find out if verbose mode is to be set.
OPT_v="${OPT_v:--q}" # Set verbose off, (default).
v='eval #' # Set verbose off, (quiet).
VERBOSE="`echo ${*} | tr ' ' '\012' | grep -- -v`"
if [ "${VERBOSE}" = "-v" ]; then # -v verbose mode on.
OPT_v="${VERBOSE}" # Will be "-v".
v="" # Set verbose on.
fi
unset VERBOSE # Unset after last use.
# CREATE NAMESPACE:
#
# - Set names of OUTPUT and WORK directories and files.
C="`basename ${0:-jbgraph}`" # Command name of this script.
C_PATH="${0}" # Called via this path.
C_rc=".${C}.rc" # .rc file, local or ${HOME}.
OUTPUT_DIR=./tmp/`echo ${C} | tr "[a-z]" "[A-Z]"` # output name in caps
mkdir -p ${OUTPUT_DIR} # Create output directory.
if [ ! -d "${OUTPUT_DIR}" ]; then # Ensure dir exists.
echo "${C}.${0}: ERROR, unable to: mkdir -p ${OUTPUT_DIR}"
exit 3
fi
# UNCOMMENT THE DATE_TIME FORMAT YOU WANT TO USE:
#DATE_TIME="`date +%y%m`" # Monthly Date/Time stamp.
#DATE_TIME="`date +%y%m%d`" # Daily Date/Time stamp.
DATE_TIME="`date +%y%m%d.%H%M`" # HourMinute Date/Time stamp.
COMMAND="${OUTPUT_DIR}/${DATE_TIME}" # Output filename date/time stamp.
WORK1="${COMMAND}.WORK1.$$" # Work file 1.
WORK2="${COMMAND}.WORK2.$$" # Work file 2.
WORK3="${COMMAND}.WORK3.$$" # Work file 3.
WORK4="${COMMAND}.WORK4.$$" # Work file 4.
# CREATE AND DISPLAY SCRIPT DEFAULTS AND INFO:
export GNU_CMDFILE="${GNU_CMDFILE:-$COMMAND.GNU_CMDFILE}" # GNU_CMDFILE name
${v}touch ${COMMAND} # Ensure the output file exists.
# Produce sample monitor and print commands.
INFO="`echo \"${C}: follow output, or print by:
rerun by executing the first commented line in:
${GNU_CMDFILE}
head -1 ${GNU_CMDFILE} # or
tail -f ${COMMAND} # tail and follow log file or
tail ${COMMAND} # tail log file or print:
fold -80 ${COMMAND} |
pr -f -l66 -h${COMMAND} |
remsh jerslash -l jer lp -odouble -o2\"`"
if [ "${OPT_v}" = "-v" ]; then # -v verbose mode.
echo "${INFO}"
fi
# DEFINE DEFAULTS, CONSTANTS, VARIABLES:
#
# - 80 Column line---------------------------------------------------01234567890
# Break line: BL is 70 columns of "-".
BL="----------------------------------------------------------------------"
EXT_OPT="${EXT_OPT:-}" # Allow external option setting.
# GNU_GEOMETRY default:
# - Note, this will respect an environment variable, which could be set as:
# - export OPT_JBGRAPH_geometry="600x450+20+20" # 4x3 aspect ratio.
OPT_JBGRAPH_geometry="${OPT_JBGRAPH_geometry:-1000x750+20+20}"
GNU_GEOMETRY_DEF="1000x750+20+20" # 4x3 aspect ratio, default.
GNU_GEOMETRY="-geometry ${OPT_JBGRAPH_geometry:-$GNU_GEOMETRY_DEF}"
# GNU_PSFILE name, (default):
GNU_PSFILE="${OPT_JBGRAPH_psfile:-$COMMAND.GNU_PSFILE}"
LP_DEV_DEF="${LP_DEV:-pastel}" # Printer device (default).
LP_OPT_DEF="${LP_OPT:--olandscape}" # Printer options (default).
# PLOT AXIS NAMES:
XLABEL="${XLABEL:-Population}" # Set default.
YLABEL_MALLOC="${YLABEL:-Bytes}" # Set default.
YLABEL_TIME="${YLABEL:-USec/index}" # Set default.
YLABEL="${YLABEL:-$YLABEL_TIME}" # Set default.
# ARRAY OF COLUMN NAMES:
#
# - Add column names here (from benchutils.c).
src/judy-1.0.5/test/jbgraph view on Meta::CPAN
# - define USAGE message.
# - use getopts.
# Note: FUNCTION__getopt is run twice, in order to support:
# FUNCTION_TITLE_COLHEAD() # Set Column headings from file.
${v}echo "${C}.${0}: beginning at `date`" # beginning of function
USAGE="${C} [ -E -G -H -I -M -S -V -i -l -m -q -r -u -v ]
[ -C GNU_CMDFILE ]
[ -D LP_DEV ]
[ -L axis ]
[ -N not option ] (turn off option), Example: -NL
[ -P GNU_PSFILE ]
[ -c COLUMN_NUMBER ]
[ -d differential_type ]
[ -g GNU_GEOMETRY ]
[ -o LP_OPT ]
[ -x xRANGE ]
[ -y yRANGE ]
${C}: wrapper for gnuplot
-c plot column number. This is useful to plot by column number.
-i plot insert; default if no other plots selected. CMN=2
-r plot retrievals; default if no other plots selected. CMN=4
-I plot memory used / index. CMN=12
-m plot memory malloced. CMN=9
-M plot memory used and free. CMN=8
-l plot leaf data. CMN=11
-d plot derivative data. Useful with -i, -r, -m. CMN=2,4,9
-x xRANGE, scale range; example: -x [1000:5000] or -x1000:5000
-y yRANGE, scale range; example: -y [1M:10M] or -y1M:10M
1[kK] = 1,000; 1[mM] = 1,000,000; 1[gG] = 1,000,000,000.
-n number plot descriptions; Use column numbers before the description.
-L set logscale axis; default,
Example: Turn off logscale with -NL, then turn on, on only one axis:
\"-NL -Lx\" or \"-NL -Ly\", Turn off both with -NL
-G grid lines on.
-H default column headings.
-g geometry description.
default=\"${GNU_GEOMETRY_DEF}\", # 4x3 aspect ratio.
-E use embedded options, default, Turn off with -NE.
Sets TITLE, COLHEAD, GETOPT from the FIRST data file encountered.
Example: embedded options in the data file begin in column 1:
# TITLE This is the title to pass to gnuplot
# COLHEAD 1 This is the heading for column 1.
# XLABEL This is the x-axis label
# YLABEL This is the y-axis label
# GETOPT -c2 -c3 -G # These are the options to use.
-p print the plot.
-o LP_OPT printer option(s); default \"${LP_OPT_DEF}\".
Example: \"-ootray2\" will print on clear slides, emits \"-otray2\"
Example: \"-on2\" will print two copies, emits \"-n2\"
-D LP_DEV printer device; default \"${LP_DEV_DEF}\".
-C GNU_CMDFILE name; default is generated and removed:
${OUTPUT_DIR}/{DATE_TIME}.GNU_CMDFILE
Useful to do your own gnuplot command editing and debugging.
-P GNU_PSFILE name. default is generated and removed:
${OUTPUT_DIR}/{DATE_TIME}.GNU_PSFILE
-S Save files.
Generated and working file names are deleted unless -S or -C is on.
User provided file names are not deleted in any case (-C, -P).
-q quiet mode, verbose mode off; default.
-v verbose mode on.
-V vi the plot file.
quit using \"q\"
-N not option; Turn specified option off. Example: -NL
Note, -N is not available for all options.
-NL Turn off: -L set logscale axis; default
-NH Turn off: -H default column headings.
-u Usage message.
Sample usage:
${C} -i -f data/datafile # -i is the same as -c1.
${C} -c1 -f data/datafile # -i is the same as -c1.
"
${v}echo "${C}.${0}: OPTIONS=${*}"
# Parse options, using getopt:
#
# - "a" option, no parameter; "b:" indicates a parameter.
# - Order of options is "man 5 ascii".
getopt_PARM="?C:D:EGIL:MN:P:SVc:d:g:ilmno:prsuvx:y:"
set -- `getopt ${getopt_PARM} $*` # Place options in argc/argv.
if [ "${?}" != "0" ]; then # If getopt returns an errror.
${v}echo "${C}.${0}: \${?}=${?}, USAGE message from return code."
echo "${USAGE}"
exit 1
fi
while [ ${#} -gt 0 ] # while there are options...
do # ( for vi parenthesis matching
${v}echo "${C}.${0}: parsing option \"${1}\", then \"${2}\""
case ${1} in
-C)
OPT_C="${1}"
OPT_C_PARM="${2}" # GNU_CMDFILE name.
${v}echo "${C}.${0}: OPT_C=${OPT_C}, # -C GNU_CMDFILE name."
${v}echo "${C}.${0}: OPT_C_PARM=${OPT_C_PARM}, # GNU_CMDFILE name."
export GNU_CMDFILE="${OPT_C_PARM}"
MSG="# GNU_CMDFILE name."
${v}echo "${C}.${0}: GNU_CMDFILE=${GNU_CMDFILE}, ${MSG}"
shift
;; # ( for vi parenthesis matching
-D)
OPT_D="${1}"
OPT_D_PARM="${2}" # LP_DEV name.
${v}echo "${C}.${0}: OPT_D=${OPT_D}, # -D LP_DEV printer device."
#${v}echo "${C}.${0}: OPT_D_PARM=${OPT_D_PARM}, # LP_DEV name."
LP_DEV="${OPT_D_PARM}"
( run in 1.113 second using v1.01-cache-2.11-cpan-13bb782fe5a )