csvsee.grinder

New in version 0.2.

Tools for working with Grinder log output and generating CSV data.

This module defines three important classes:

  • Bin: Statistics collected over a certain time interval
  • Test: All statistics for a single Test in a Grinder test run
  • Report: Collection of Test statistics and functions to write CSV reports

To generate reports, simply instantiate a Report instance, providing the report granularity in seconds, the name of the out_* file, and at least one data_* file generated by Grinder:

from csvsee import grinder
report = grinder.Report(60, 'out-0.log', 'data-0.log')

Or, if you have multiple data_* files:

report = grinder.Report(60, 'out-0.log', 'data-0.log', 'data-1.log', 'data-2.log')

The granularity determines how fine-grained the timestamps in your report will be; with 60-second granularity, all statistics during each 60-second interval are accumulated and reported together. For more detail, you could use 1-second granularity:

report = grinder.Report(1, 'out-0.log', 'data-0.log')

but this will increase the size of your CSV data considerably and result in much noisier-looking data. If you’re doing a long-term load test spanning hours, you might use a larger value, say 10 minutes:

report = grinder.Report(600, 'out-0.log', 'data-0.log')

This will give smaller CSV files with smoother data, at the expense of some detail; you won’t be able to see data spikes as easily.

Now, you can generate a bunch of predetermined CSV files like this:

report.write_all_csvs('my_results')

The given string will be prefixed all the CSV filenames.

class csvsee.grinder.Bin(stat_names)

Accumulated statistics for an interval of time.

add(row)

Accumulate a row of statistics in this bin. All statistics are accumulated as integers.

average(stat)

Return the integer average (mean) of the given statistic.

exception csvsee.grinder.NoTestNames

Failure to find any test names in a Grinder out* file.

class csvsee.grinder.Report(granularity, grinder_outfile, *grinder_datafiles)

A report of statistics for a Grinder test run.

add(row)

Add a row from a data* file to the stats.

populate_stats()

Add statistics for all tests in all Grinder data files.

timestamp_range()

Return the (start, end) timestamps for this report, based on the timestamps of all tests within it.

write_all_csvs(csv_prefix)

Write all CSV files for this report to files with the given prefix.

write_csv(stat, filename)

Write the given statistic for all tests to filename.

class csvsee.grinder.Test(number, name, granularity=1)

Statistics for a single Test in a Grinder test run.

add(row)

Add a row of statistics for this test.

stat_at_time(stat, timestamp)

Return a statistic at the given timestamp (either sum or average). Return 0 if there is no data at the given time.

timestamp_range()

Return the (start, end) timestamps for this test.

csvsee.grinder.get_test_names(outfile)

Return a dict of {number: name} for each test from the summary portion of the given Grinder out* file. If the summary portion is not found, look for test numbers and names as logged by grinder-webtest.

csvsee.grinder.grinder_files(include_dir)

Return a list of full pathnames to all out* and data* files found in descendants of include_dir.

Project Versions

Previous topic

csvsee.graph

This Page