Merge pull request #8326 from priyawadhwa/float

Round floats to one decimal point for mkcmp
pull/8329/head
priyawadhwa 2020-05-29 15:56:02 -07:00 committed by GitHub
commit 1f9896bfe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -69,8 +69,12 @@ func (rm *resultManager) summarizeResults(binaries []*Binary, driver string) {
fmt.Printf("**%s Driver**\n", driver)
for _, b := range binaries {
fmt.Printf("Times for %s: %v\n", b.Name(), rm.totalTimes(b))
fmt.Printf("Average time for %s: %v\n\n", b.Name(), rm.averageTime(b))
fmt.Printf("Times for %s: ", b.Name())
for _, tt := range rm.totalTimes(b) {
fmt.Printf("%.1fs ", tt)
}
fmt.Println()
fmt.Printf("Average time for %s: %.1fs\n\n", b.Name(), rm.averageTime(b))
}
// print out summary per log
@ -98,7 +102,7 @@ func (rm *resultManager) summarizeTimesPerLog(binaries []*Binary) {
if index == -1 {
continue
}
table[index][i+1] = fmt.Sprintf("%f", time)
table[index][i+1] = fmt.Sprintf("%.1fs", time)
}
}

View File

@ -38,7 +38,8 @@ func CompareMinikubeStart(ctx context.Context, out io.Writer, binaries []*Binary
for _, d := range drivers {
rm, err := collectResults(ctx, binaries, d)
if err != nil {
log.Printf("error collecting results for %s driver: %v", d, err)
fmt.Printf("**%s Driver**\n", d)
fmt.Printf("error collecting results for %s driver: %v\n", d, err)
continue
}
rm.summarizeResults(binaries, d)
@ -50,7 +51,7 @@ func CompareMinikubeStart(ctx context.Context, out io.Writer, binaries []*Binary
func collectResults(ctx context.Context, binaries []*Binary, driver string) (*resultManager, error) {
rm := newResultManager()
for run := 0; run < runs; run++ {
log.Printf("Executing run %d/%d...", run, runs)
log.Printf("Executing run %d/%d...", run+1, runs)
for _, binary := range binaries {
r, err := timeMinikubeStart(ctx, binary, driver)
if err != nil {