Skip to content

Instantly share code, notes, and snippets.

@roblogic
Created April 5, 2017 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roblogic/c7b0bb462466f8fae6e41ef246e77b57 to your computer and use it in GitHub Desktop.
Save roblogic/c7b0bb462466f8fae6e41ef246e77b57 to your computer and use it in GitHub Desktop.
Jmeter log processing script (probably obsolete)
#!/bin/sh
# jtlmin.sh :
# JMeter log processing script
# Collects & Averages throughput data using 1-minute increments
# Requires CSV-formatted log from JMeter "Simple Data Writer".
#
# Version Date Author Comment
# 2.0 2009-02-17 R. Papesch Refined awk procedure, renamed variables
# 1.0 2006-11-28 R. Papesch
#set -x #debug
USAGE="Usage: jtlmin.sh \nSummarizes JMeter JTL output into 1-minute blocks"
[ $1 ] || { echo -e $USAGE; exit 1 ; }
echo -e "Processing \c"
ls $1 || { exit 1 ; }
main()
{
WORKFILE=$1.jtlmin.$$.WORKING
OUTFILE=$1.jtlmin.$$.OUT
STEP=60 # $WORKFILE
echo "Outputting data to $OUTFILE .."
echo "$PWD/$1" >> $OUTFILE
echo -e "unixtime \tdate \ttime \tthruput(tpm) \tresponse(ms) " >> $OUTFILE
awk_routine | sort >> $OUTFILE
rm $WORKFILE
}
awk_routine()
{
awk '
NR!=1 {minute[$1]++; rsum[$1]=rsum[$1]+$2}
END {
for (i in minute) {
printf("%d\t", i);
printf("%s\t", strftime("%Y.%b.%d",i));
printf("%s\t", strftime("%H:%M",i));
printf("%d\t", minute[i]);
printf("%d\n", rsum[i]/minute[i])
}
}' $WORKFILE
}
main $*
@roblogic
Copy link
Author

roblogic commented Apr 5, 2017

Background here. And more examples here. Originally designed for parsing JTL output from JMeter 2.2 with unix timestamps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment