Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The heart of my Perl data-mangler is this regular expression:

No Format
# Each line in logfile is matched to this regular expression to grab relevant details from the log entry. 

/timeStamp="(\d+)".+?threadName="(.*?)".+?label="(.+?)" time="(\d+?)".+?success="(.+?)"/;

Here are the comments for that regex:

No Format
# GrabExplanation the relevant details from the log entry. for regex:
# A normal log entry line logs one HTTP 'sampler' operation:
# 	<sampleResult timeStamp="..." ... threadName="..." label="..." time="..." />
# In case the opertion had HTTP redirects, the redirects show up as 
# nested <sampleResult> elements,  but still on the same line:
# 	<sampleResult timeStamp= ... > <sampleResult timeStamp=.... > ... </sampleResult>
# We are only interested in the data in the first <sampleResult> element, 
# so we use non-greedy pattern match operator ( '.*?' or '.+?') to ignore 
# any latter <sampleResult> elements,

These are the temporary Perl variables that this regular expression generates:

No Format


# The temporary Perl variables this regular expression generates are used to write a comma-delimited line.
my $timestamp = $1; # unix timestamp 
my $threadname = $2; # thread label
my $label = $3; # operation label 
my $time = $4; # operation time in milliseconds
my $success = $5; # boolean success indicator for this operation

...

2. Once the data is in Excel, I convert the timestamp column from Jmeter's Unix timestamp format (base year 1970) to the Excel format (base year 1900) using this following formula. This formula is applied to the entire timestamp column. (NOTE: a better formula was mentioned on JMeter users list sometime back)

...