Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(612)

Delta Between Two Patch Sets: src/pkg/testing/benchmark.go

Issue 6565061: code review 6565061: testing: remove redundant whitespace in output (Closed)
Left Patch Set: Created 11 years, 6 months ago
Right Patch Set: diff -r debb590074da https://code.google.com/p/go Created 11 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package testing 5 package testing
6 6
7 import ( 7 import (
8 "flag" 8 "flag"
9 "fmt" 9 "fmt"
10 "os" 10 "os"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if nsop < 10 { 249 if nsop < 10 {
250 ns = fmt.Sprintf("%13.2f ns/op", float64(r.T.Nanoseconds ())/float64(r.N)) 250 ns = fmt.Sprintf("%13.2f ns/op", float64(r.T.Nanoseconds ())/float64(r.N))
251 } else { 251 } else {
252 ns = fmt.Sprintf("%12.1f ns/op", float64(r.T.Nanoseconds ())/float64(r.N)) 252 ns = fmt.Sprintf("%12.1f ns/op", float64(r.T.Nanoseconds ())/float64(r.N))
253 } 253 }
254 } 254 }
255 return fmt.Sprintf("%8d\t%s%s", r.N, ns, mb) 255 return fmt.Sprintf("%8d\t%s%s", r.N, ns, mb)
256 } 256 }
257 257
258 func (r BenchmarkResult) MemString() string { 258 func (r BenchmarkResult) MemString() string {
259 » return fmt.Sprintf("\t%8d B/op\t%8d allocs/op", 259 » return fmt.Sprintf("%8d B/op\t%8d allocs/op",
260 r.AllocedBytesPerOp(), r.AllocsPerOp()) 260 r.AllocedBytesPerOp(), r.AllocsPerOp())
261 } 261 }
262 262
263 // An internal function but exported because it is cross-package; part of the im plementation 263 // An internal function but exported because it is cross-package; part of the im plementation
264 // of the "go test" command. 264 // of the "go test" command.
265 func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks [ ]InternalBenchmark) { 265 func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks [ ]InternalBenchmark) {
266 // If no flag was specified, don't run benchmarks. 266 // If no flag was specified, don't run benchmarks.
267 if len(*matchBenchmarks) == 0 { 267 if len(*matchBenchmarks) == 0 {
268 return 268 return
269 } 269 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // custom benchmarks that do not use the "go test" command. 336 // custom benchmarks that do not use the "go test" command.
337 func Benchmark(f func(b *B)) BenchmarkResult { 337 func Benchmark(f func(b *B)) BenchmarkResult {
338 b := &B{ 338 b := &B{
339 common: common{ 339 common: common{
340 signal: make(chan interface{}), 340 signal: make(chan interface{}),
341 }, 341 },
342 benchmark: InternalBenchmark{"", f}, 342 benchmark: InternalBenchmark{"", f},
343 } 343 }
344 return b.run() 344 return b.run()
345 } 345 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b