Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:17:38+00:00 2026-06-15T08:17:38+00:00

I’m generating some load test results with jmeter and it outputs nicely formatted csv

  • 0

I’m generating some load test results with jmeter and it outputs nicely formatted csv file, but now I need to do some number crunching with ruby. An example beginning of the csv file:

threadName,grpThreads,allThreads,URL,Latency,SampleCount,ErrorCount
Thread Group 1-1,1,1,urlXX,240,1,0
Thread Group 1-1,1,1,urlYY,463,1,0
Thread Group 1-2,1,1,urlXX,200,1,0
Thread Group 1-3,1,1,urlXX,212,1,0
Thread Group 1-2,1,1,urlYY,454,1,0
.
.
.
Thread Group 1-N,1,1,urlXX,210,1,0

Now, for statistics I need to read the first line of each thread group, add the Latency fields up and then divide with the amount of thread groups I have, to just get an average latency. Then iterate to the second line of every thread group and so forth..

I was thinking that maybe I would need to write some temporary sorted csv files for each thread group (the order of the url’s are hit is always the same within a thread group) and then use those as input, add first lines, do math, add second lines until there are no more lines.

But since the amount of thread groups change, I haven’t been able to write ruby so that it could flex around that… any code examples would be really appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:17:41+00:00Added an answer on June 15, 2026 at 8:17 am

    [update] – Is this what you want, I wonder?

    How about this – it’s probably inefficient but does it do what you want?

    CSV = File.readlines("data.csv")
    CSV.shift # minus the header.
    
    # Hash where key is grp name; value is list of HASHES with keys {:grp, :lat}
    hash = CSV.
      map {|l| # Turn every line into a HASH of grp name and it's lats.
        fs = l.split(","); {:grp => fs[0], :lat => fs[4]} 
      }.
      group_by{|o| o[:grp]}
    
    # The largest number of lines we have in any group
    max_lines = hash.max_by{|gname, l| l.size}.size
    
    # AVGS is a list of averages. 
    # AVGS[0] is the average lat. for all the first lines,
    # AVGS[1] is the average lat. for all second lines, etc.
    AVGS = 
    (0..(max_lines-1)).map{|lno| # line no
      total = # total latency for the i'th line...
        hash.map {|gname, l|
          if l[lno] then  l[lno][:lat].to_i
          else 0 end
        }
      total.reduce{|a,b| a+b} / (hash.size)
    }
    
    # So we have 'L' Averages - where L is the maximum number of
    # lines in any group. You could do anything with this list
    # of numbers... find the average again?
    puts AVGS.inspect
    

    Should return something like:

    [217/*avg for 1st-liners*/, 305 /*avg for 2nd liners*/]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
In my XML file chapters tag has more chapter tag.i need to display chapters
I need to clean up various Word 'smart' characters in user input, including but
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.