Attachment 'jtlmin.sh.txt'

Download

   1 #!/bin/sh
   2 # jtlmin.sh :
   3 #   JMeter log processing script 
   4 #   Collects & Averages throughput data using 1-minute increments
   5 #   Requires CSV-formatted log from JMeter "Simple Data Writer".
   6 #
   7 #   Version   Date          Author      Comment
   8 #       2.0   2009-02-17    R. Papesch  Refined awk procedure, renamed variables
   9 #       1.0   2006-11-28    R. Papesch
  10 
  11 #set -x  #debug
  12 
  13 USAGE="Usage: jtlmin.sh <filename> \nSummarizes JMeter JTL output into 1-minute blocks"
  14 [ $1 ] || { echo -e $USAGE; exit 1 ; }
  15 echo -e "Processing \c"
  16 ls $1 || { exit 1 ; }
  17 
  18 main()
  19 {
  20   WORKFILE=$1.jtlmin.$$.WORKING
  21   OUTFILE=$1.jtlmin.$$.OUT
  22   STEP=60       # <-- can modify this value for larger time increments
  23 
  24   # Workfile: Chop milliseconds, Round timestamps to nearest Minute
  25   sed -n '2,$ p' $1 | cut -c -10,14- | sort | awk -F',' -v step=$STEP '{print $1-$1%step,$2}' > $WORKFILE
  26 
  27   echo "Outputting data to $OUTFILE .."
  28   echo "$PWD/$1" > $OUTFILE
  29   echo -e "unixtime \tdate \ttime \tthruput(tpm) \tresponse(ms) " >> $OUTFILE
  30   awk_routine | sort >> $OUTFILE
  31 
  32   rm $WORKFILE
  33 }  
  34 
  35 awk_routine()
  36 {
  37   awk '
  38     NR!=1 {minute[$1]++; rsum[$1]=rsum[$1]+$2}
  39     END {
  40       for (i in minute) {
  41         printf("%d\t", i);
  42         printf("%s\t", strftime("%Y.%b.%d",i));
  43         printf("%s\t", strftime("%H:%M",i));
  44         printf("%d\t", minute[i]);
  45         printf("%d\n", rsum[i]/minute[i])
  46       }
  47     }' $WORKFILE 
  48 }
  49 
  50 main $*

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.