Extract Transaction Data From LoadRunner Analysis

June 15, 2008 – 3:38 pm

I had a need to extract transaction response time data from a bunch of LoadRunner Analysis files, and I really didn’t want to do endless cut and paste operations from within the LoadRunner Analysis tool. I created this Python script to extract transaction response time data from the LoadRunner Analysis mdb file and output into CSV format, which can then be imported into MySQL, Excel, etc. The analysis file is a MS Access JET Database which allows the use of Python’s win32com module to access the data.


# lr_extract.py
# --------------------------------------------------------------------
# Extracts Transaction response time data from the MS Jet database file (.mdb)
# created by LoadRunner Analysis tool
#
# Requires DAO 3.6 library.
# --------------------------------------------------------------------
# Usage: python lr_extract.py lr_analysis.mdb
import sys
import string
import pythoncom
import win32com.client

const = win32com.client.constants

daoEngine = win32com.client.Dispatch('DAO.DBEngine.36')
db = daoEngine.OpenDatabase(sys.argv[1])

query = """
select
    [Result].[Start Time]+[Event_meter].[End Time] as t_stamp,
    [Event_map].[Event Name] as txn_name,
    [Event_meter].[Value] as resp_time,
    [Result].[Result Name] as result_name
from
    Result,
    Event_map,
    Event_meter
where
    [Event_map].[Event Type] = 'Transaction' and
    [Event_meter].[Event ID] = [Event_map].[Event ID]
order by [Result].[Start Time]+[Event_meter].[End Time]
"""
rs = db.OpenRecordset(query)

print("timestamp,transaction,response time,result name")
while not rs.EOF:
    print("%s,%s,%s,%s" % (rs.Fields[0],rs.Fields[1],rs.Fields[2],rs.Fields[3]) )
    rs.MoveNext()
  1. 2 Responses to “Extract Transaction Data From LoadRunner Analysis”

  2. I haven’t tested it yet, but I believe this would be the Ruby equivalent. Thanks for providing the logic! =)


    require 'win32ole'
    connection = WIN32OLE.new('ADODB.Connection')
    connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=#{ARGV[0]}”)

    query = “”"
    select
    [Result].[Start Time]+[Event_meter].[End Time] as t_stamp,
    [Event_map].[Event Name] as txn_name,
    [Event_meter].[Value] as resp_time,
    [Result].[Result Name] as result_name
    from
    Result,
    Event_map,
    Event_meter
    where
    [Event_map].[Event Type] = ‘Transaction’ and
    [Event_meter].[Event ID] = [Event_map].[Event ID]
    order by [Result].[Start Time]+[Event_meter].[End Time]
    “”"

    recordset = WIN32OLE.new(’ADODB.Recordset’)
    recordset.Open(sql, connection)
    rs = recordset.GetRows.transpose
    recordset.Close

    puts “timestamp,transaction,response time,result name”
    rs.each do |row|
    puts row.[0], row[1], row[2], row[3]
    end

    By Tim Koopmans on Jun 15, 2008

  3. This is pretty cool - very nice!
    I’m curious as to what external tool/database are you extracting the data? What’s the purpose of taking the data to external tool? (isn’t the Analysis tool pretty enough?) What kind of interfaces would you like to see enabled? I’d love to hear more ideas on this. Cheers!

    By Mark Tomlinson on Jul 17, 2008

Post a Comment