mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
benchmark: add --precise flag
Usually benchmark writes with %4.4f; this adds optional %g formatting.
This commit is contained in:
parent
3d28faa3eb
commit
e7d8292cd1
@ -37,6 +37,7 @@ var (
|
|||||||
endpoints []string
|
endpoints []string
|
||||||
totalConns uint
|
totalConns uint
|
||||||
totalClients uint
|
totalClients uint
|
||||||
|
precise bool
|
||||||
sample bool
|
sample bool
|
||||||
|
|
||||||
bar *pb.ProgressBar
|
bar *pb.ProgressBar
|
||||||
@ -55,6 +56,7 @@ func init() {
|
|||||||
RootCmd.PersistentFlags().UintVar(&totalConns, "conns", 1, "Total number of gRPC connections")
|
RootCmd.PersistentFlags().UintVar(&totalConns, "conns", 1, "Total number of gRPC connections")
|
||||||
RootCmd.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients")
|
RootCmd.PersistentFlags().UintVar(&totalClients, "clients", 1, "Total number of gRPC clients")
|
||||||
|
|
||||||
|
RootCmd.PersistentFlags().BoolVar(&precise, "precise", false, "use full floating point precision")
|
||||||
RootCmd.PersistentFlags().BoolVar(&sample, "sample", false, "'true' to sample requests for every second")
|
RootCmd.PersistentFlags().BoolVar(&sample, "sample", false, "'true' to sample requests for every second")
|
||||||
RootCmd.PersistentFlags().StringVar(&tls.CertFile, "cert", "", "identify HTTPS client using this SSL certificate file")
|
RootCmd.PersistentFlags().StringVar(&tls.CertFile, "cert", "", "identify HTTPS client using this SSL certificate file")
|
||||||
RootCmd.PersistentFlags().StringVar(&tls.KeyFile, "key", "", "identify HTTPS client using this SSL key file")
|
RootCmd.PersistentFlags().StringVar(&tls.KeyFile, "key", "", "identify HTTPS client using this SSL key file")
|
||||||
|
@ -86,8 +86,12 @@ func mustRandBytes(n int) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newReport() report.Report {
|
func newReport() report.Report {
|
||||||
|
p := "%4.4f"
|
||||||
|
if precise {
|
||||||
|
p = "%g"
|
||||||
|
}
|
||||||
if sample {
|
if sample {
|
||||||
return report.NewReportSample("%4.4f")
|
return report.NewReportSample(p)
|
||||||
}
|
}
|
||||||
return report.NewReport("%4.4f")
|
return report.NewReport(p)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user