]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go, doc/go1.3.txt: misc/benchcmp has been replaced by go tool benchcmp
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 4 Feb 2014 19:53:13 +0000 (11:53 -0800)
committerRob Pike <r@golang.org>
Tue, 4 Feb 2014 19:53:13 +0000 (11:53 -0800)
Fixes #7016.

LGTM=r
R=r
CC=adg, bradfitz, dave, golang-codereviews
https://golang.org/cl/60100043

doc/go1.3.txt
misc/benchcmp [deleted file]
src/cmd/go/pkg.go
src/cmd/go/tool.go

index 4c25375d09ce2bda41b11a59dbfaa51cb8212fd9..3da88a5a2c804c26bcca19b502460655f626b5a4 100644 (file)
@@ -4,3 +4,4 @@ misc/dist: renamed misc/makerelease (CL 39920043)
 runtime: output how long goroutines are blocked (CL 50420043)
 syscall: add NewCallbackCDecl to use for windows callbacks (CL 36180044)
 testing: diagnose buggy tests that panic(nil) (CL 55780043)
+misc/benchcmp has been replaced by go tool benchcmp (CL 47980043)
diff --git a/misc/benchcmp b/misc/benchcmp
deleted file mode 100755 (executable)
index 3180f57..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/sh
-# Copyright 2011 The Go Authors.  All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-case "$1" in
--*)    
-       echo 'usage: benchcmp old.txt new.txt' >&2
-       echo >&2
-       echo 'Each input file should be from:' >&2
-       echo '  go test -test.run=NONE -test.bench=. > [old,new].txt' >&2
-       echo >&2
-       echo 'Benchcmp compares the first and last for each benchmark.' >&2
-       echo >&2
-       echo 'If -test.benchmem=true is added to the "go test" command' >&2
-       echo 'benchcmp will also compare memory allocations.' >&2
-       exit 2
-esac
-
-awk '
-BEGIN {
-       n = 0
-}
-
-$1 ~ /Benchmark/ && $4 == "ns/op" {
-       if(old[$1]) {
-               if(!saw[$1]++) {
-                       name[n++] = $1
-                       if(length($1) > len)
-                               len = length($1)
-               }
-               new[$1] = $3
-               if($6 == "MB/s")
-                       newmb[$1] = $5
-
-               # allocs/op might be at $8 or $10 depending on if
-               # SetBytes was used or not.
-               # B/op might be at $6 or $8, it should be immediately
-               # followed by allocs/op
-               if($8 == "allocs/op") {
-                       newbytes[$1] = $5
-                       newalloc[$1] = $7
-               }
-               if($10 == "allocs/op") {
-                       newbytes[$1] = $7
-                       newalloc[$1] = $9
-               }
-       } else {
-               old[$1] = $3
-               if($6 == "MB/s")
-                       oldmb[$1] = $5
-               if($8 == "allocs/op") {
-                       oldbytes[$1] = $5
-                       oldalloc[$1] = $7
-               }
-               if($10 == "allocs/op") {
-                       oldbytes[$1] = $7
-                       oldalloc[$1] = $9
-               }
-       }
-}
-
-END {
-       if(n == 0) {
-               print "benchcmp: no repeated benchmarks" >"/dev/stderr"
-               exit 1
-       }
-
-       printf("%-*s %12s %12s  %7s\n", len, "benchmark", "old ns/op", "new ns/op", "delta")
-
-       # print ns/op
-       for(i=0; i<n; i++) {
-               what = name[i]
-               printf("%-*s %12d %12d  %6s%%\n", len, what, old[what], new[what],
-                       sprintf("%+.2f", 100*new[what]/old[what]-100))
-       }
-
-       # print mb/s
-       anymb = 0
-       for(i=0; i<n; i++) {
-               what = name[i]
-               if(!(what in newmb))
-                       continue
-               if(anymb++ == 0)
-                       printf("\n%-*s %12s %12s  %7s\n", len, "benchmark", "old MB/s", "new MB/s", "speedup")
-               printf("%-*s %12s %12s  %6sx\n", len, what,
-                       sprintf("%.2f", oldmb[what]),
-                       sprintf("%.2f", newmb[what]),
-                       sprintf("%.2f", newmb[what]/oldmb[what]))
-       }
-
-       # print allocs
-       anyalloc = 0
-       for(i=0; i<n; i++) {
-               what = name[i]
-               if(!(what in newalloc))
-                       continue
-               if(anyalloc++ == 0)
-                       printf("\n%-*s %12s %12s  %7s\n", len, "benchmark", "old allocs", "new allocs", "delta")
-               if(oldalloc[what] == 0)
-                       delta="n/a"
-               else
-                       delta=sprintf("%.2f", 100*newalloc[what]/oldalloc[what]-100)
-               printf("%-*s %12d %12d  %6s%%\n", len, what,
-                       oldalloc[what], newalloc[what], delta)
-       }
-
-       # print alloc bytes
-       anybytes = 0
-       for(i=0; i<n; i++) {
-               what = name[i]
-               if(!(what in newbytes))
-                       continue
-               if(anybytes++ == 0)
-                       printf("\n%-*s %12s %12s  %7s\n", len, "benchmark", "old bytes", "new bytes", "delta")
-               if(oldbytes[what] == 0)
-                       delta="n/a"
-               else
-                       delta=sprintf("%.2f", 100*newbytes[what]/oldbytes[what]-100)
-               printf("%-*s %12d %12d  %6s%%\n", len, what,
-                       oldbytes[what], newbytes[what], delta)
-       }
-}
-' "$@"
index 785fac2627c7ca4729027f1ddced717df6d43076..2f4f6cc558276ccb0026e6eb2cab43213a1df461 100644 (file)
@@ -304,16 +304,17 @@ const (
 
 // goTools is a map of Go program import path to install target directory.
 var goTools = map[string]targetDir{
-       "cmd/api":                              toTool,
-       "cmd/cgo":                              toTool,
-       "cmd/fix":                              toTool,
-       "cmd/link":                             toTool,
-       "cmd/nm":                               toTool,
-       "cmd/pack":                             toTool,
-       "cmd/yacc":                             toTool,
-       "code.google.com/p/go.tools/cmd/cover": toTool,
-       "code.google.com/p/go.tools/cmd/godoc": toBin,
-       "code.google.com/p/go.tools/cmd/vet":   toTool,
+       "cmd/api":  toTool,
+       "cmd/cgo":  toTool,
+       "cmd/fix":  toTool,
+       "cmd/link": toTool,
+       "cmd/nm":   toTool,
+       "cmd/pack": toTool,
+       "cmd/yacc": toTool,
+       "code.google.com/p/go.tools/cmd/benchcmp": toTool,
+       "code.google.com/p/go.tools/cmd/cover":    toTool,
+       "code.google.com/p/go.tools/cmd/godoc":    toBin,
+       "code.google.com/p/go.tools/cmd/vet":      toTool,
 }
 
 // expandScanner expands a scanner.List error into all the errors in the list.
index 6d26f7a4b4ada01e83c84ce2c2b7ca1719b5cb12..943a33ea89d4c2ef7a0b9149ce7bb3ecbeaf5beb 100644 (file)
@@ -65,7 +65,7 @@ func tool(toolName string) string {
 
 func isInGoToolsRepo(toolName string) bool {
        switch toolName {
-       case "cover", "vet":
+       case "benchcmp", "cover", "vet":
                return true
        }
        return false