Skip to content

Commit

Permalink
feature: 95th percentile in latency statistics
Browse files Browse the repository at this point in the history
This commit adds stats showing the 95th percentile latency when using the latency statistics flag (-l) or output to json flag (-o j)
Output examples:
Latency Distribution
     50%    79.57ms
     75%    84.17ms
     90%   115.31ms
     95%   241.90ms
     99%   248.48ms

"percentiles":{"50":0.000000,"75":0.000000,"90":0.000000,"95":117.775379,"99":117.775379}
  • Loading branch information
Andrew authored and codesenberg committed Mar 16, 2018
1 parent ab38466 commit db65d7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions templates.go
Expand Up @@ -37,12 +37,12 @@ func formatFromString(formatSpec string) format {
const (
plainTextTemplate = `
{{- printf "%10v %10v %10v %10v" "Statistics" "Avg" "Stdev" "Max" }}
{{ with .Result.RequestsStats (FloatsToArray 0.5 0.75 0.9 0.99) }}
{{ with .Result.RequestsStats (FloatsToArray 0.5 0.75 0.9 0.95 0.99) }}
{{- printf " %-10v %10.2f %10.2f %10.2f" "Reqs/sec" .Mean .Stddev .Max -}}
{{ else }}
{{- print " There wasn't enough data to compute statistics for requests." }}
{{ end }}
{{ with .Result.LatenciesStats (FloatsToArray 0.5 0.75 0.9 0.99) }}
{{ with .Result.LatenciesStats (FloatsToArray 0.5 0.75 0.9 0.95 0.99) }}
{{- printf " %-10v %10v %10v %10v" "Latency" (FormatTimeUs .Mean) (FormatTimeUs .Stddev) (FormatTimeUs .Max) }}
{{- if WithLatencies }}
{{- "\n Latency Distribution" }}
Expand Down Expand Up @@ -138,7 +138,7 @@ const (
]
{{- end -}}
{{- with .LatenciesStats (FloatsToArray 0.5 0.75 0.9 0.99) -}}
{{- with .LatenciesStats (FloatsToArray 0.5 0.75 0.9 0.95 0.99) -}}
,"latency":{"mean":{{ .Mean -}}
,"stddev":{{ .Stddev -}}
,"max":{{ .Max -}}
Expand All @@ -155,7 +155,7 @@ const (
}
{{- end -}}
{{- with .RequestsStats (FloatsToArray 0.5 0.75 0.9 0.99) -}}
{{- with .RequestsStats (FloatsToArray 0.5 0.75 0.9 0.95 0.99) -}}
,"rps":{"mean":{{ .Mean -}}
,"stddev":{{ .Stddev -}}
,"max":{{ .Max -}}
Expand Down

0 comments on commit db65d7c

Please sign in to comment.