class Cryload::Stats

Overview

Stats holder for the benchmark

Defined in:

cryload/stats.cr

Constant Summary

HISTOGRAM_BUCKET_COUNT = ((Math.log(HISTOGRAM_MAX_MS / HISTOGRAM_MIN_MS)) / HISTOGRAM_LOG_GROWTH).ceil.to_i + 1
HISTOGRAM_GROWTH = 1.01
HISTOGRAM_LOG_GROWTH = Math.log(HISTOGRAM_GROWTH)
HISTOGRAM_MAX_MS = 3600000.0
HISTOGRAM_MIN_MS = 0.001

HDR-style logarithmic histogram: ~1% relative precision from 1µs to 1h in a few thousand buckets, instead of a dense linear bucket array.

TIME_IN_MILISECONDS = 1000

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(request_number : Int32, duration_mode : Bool = false, benchmark_start : Time::Instant = Time.instant, url : String = "", output_format : String = "text", success_status_ranges : Array(Range(Int32, Int32)) = [200..299], ci_thresholds : CiThresholds = CiThresholds.new, progress_enabled : Bool = false) #

Class Method Detail

def self.histogram_bucket_index(value_ms : Float64) : Int32 #

def self.histogram_bucket_value(index : Int32) : Float64 #

Geometric midpoint of the bucket, the best estimate for values in it.


Instance Method Detail

def <<(request : Request) #

def average_bytes_per_response #

def average_request_time #

def benchmark_start : Time::Instant #

def bytes_per_second #

def ci_thresholds : Cryload::CiThresholds #

def csv_output #

def duration_mode : Bool #

def empty? #

def error_counts #

def failure_rate_percent #

def final_exit_code #

def json_output #

def latency_histogram_bins(bin_count : Int32 = 11) #

def latency_stdev #

def mark_benchmark_end #

def max_request_time #

def merge_batch(batch : Batch) #

def min_request_time #

def not_ok_requests #

def ok_requests #

def output_format : String #

def p10_request_time #

def p25_request_time #

def p50_request_time #

def p75_request_time #

def p90_request_time #

def p95_request_time #

def p999_request_time #

def p99_request_time #

def progress_enabled : Bool #

def quiet_output #

def record_error(category : String) #

def record_response(time_taken_ms : Float64, status_code : Int32, response_bytes : Int64 = 0_i64) #

def request_number : Int32 #

def request_per_second #

Requests per second = total requests / wall clock time (actual throughput)


def response_count #

def status_code_counts #

def success_status_ranges : Array(Range(Int32, Int32)) #

def text_output? #

def total_request_count #

def total_request_time_in_seconds #

def total_response_bytes #

def transport_error_count #

def url : String #

def wall_clock_seconds #

Wall clock time from benchmark start to report completion.