summaryrefslogtreecommitdiff
path: root/test/bench/garbage
diff options
context:
space:
mode:
Diffstat (limited to 'test/bench/garbage')
-rw-r--r--test/bench/garbage/parser.go97
-rw-r--r--test/bench/garbage/stats.go15
-rw-r--r--test/bench/garbage/tree2.go8
3 files changed, 94 insertions, 26 deletions
diff --git a/test/bench/garbage/parser.go b/test/bench/garbage/parser.go
index d66281b6b..ff7630a9e 100644
--- a/test/bench/garbage/parser.go
+++ b/test/bench/garbage/parser.go
@@ -134,20 +134,31 @@ func main() {
}
}
+// find . -type d -not -path "./exp" -not -path "./exp/*" -printf "\t\"%p\",\n" | sort | sed "s/\.\///" | grep -v testdata
var packages = []string{
+ "archive",
"archive/tar",
- "encoding/asn1",
- "math/big",
+ "archive/zip",
"bufio",
+ "builtin",
"bytes",
- "math/cmplx",
+ "compress",
+ "compress/bzip2",
"compress/flate",
"compress/gzip",
+ "compress/lzw",
"compress/zlib",
+ "container",
"container/heap",
"container/list",
"container/ring",
+ "crypto",
"crypto/aes",
+ "crypto/cipher",
+ "crypto/des",
+ "crypto/dsa",
+ "crypto/ecdsa",
+ "crypto/elliptic",
"crypto/hmac",
"crypto/md5",
"crypto/rand",
@@ -159,66 +170,112 @@ var packages = []string{
"crypto/subtle",
"crypto/tls",
"crypto/x509",
+ "crypto/x509/pkix",
+ "database",
+ "database/sql",
+ "database/sql/driver",
+ "debug",
"debug/dwarf",
- "debug/macho",
"debug/elf",
"debug/gosym",
- "exp/ebnf",
+ "debug/macho",
+ "debug/pe",
+ "encoding",
"encoding/ascii85",
+ "encoding/asn1",
+ "encoding/base32",
"encoding/base64",
"encoding/binary",
+ "encoding/csv",
+ "encoding/gob",
"encoding/hex",
+ "encoding/json",
"encoding/pem",
- "os/exec",
+ "encoding/xml",
+ "errors",
+ "expvar",
"flag",
"fmt",
+ "go",
"go/ast",
+ "go/build",
"go/doc",
+ "go/format",
"go/parser",
"go/printer",
"go/scanner",
"go/token",
- "encoding/gob",
+ "go/types",
"hash",
"hash/adler32",
"hash/crc32",
"hash/crc64",
- "net/http",
+ "hash/fnv",
+ "html",
+ "html/template",
"image",
+ "image/color",
+ "image/draw",
+ "image/gif",
"image/jpeg",
"image/png",
+ "index",
+ "index/suffixarray",
"io",
"io/ioutil",
- "encoding/json",
"log",
+ "log/syslog",
"math",
+ "math/big",
+ "math/cmplx",
+ "math/rand",
"mime",
+ "mime/multipart",
"net",
+ "net/http",
+ "net/http/cgi",
+ "net/http/cookiejar",
+ "net/http/fcgi",
+ "net/http/httptest",
+ "net/http/httputil",
+ "net/http/pprof",
+ "net/mail",
+ "net/rpc",
+ "net/rpc/jsonrpc",
+ "net/smtp",
+ "net/textproto",
+ "net/url",
"os",
- "exp/signal",
+ "os/exec",
+ "os/signal",
+ "os/user",
"path",
- "math/rand",
+ "path/filepath",
"reflect",
"regexp",
- "net/rpc",
+ "regexp/syntax",
"runtime",
- "text/scanner",
+ "runtime/cgo",
+ "runtime/debug",
+ "runtime/pprof",
+ "runtime/race",
"sort",
- "net/smtp",
"strconv",
"strings",
"sync",
+ "sync/atomic",
"syscall",
- "log/syslog",
- "text/tabwriter",
- "text/template",
"testing",
"testing/iotest",
"testing/quick",
- "testing/script",
+ "text",
+ "text/scanner",
+ "text/tabwriter",
+ "text/template",
+ "text/template/parse",
"time",
"unicode",
- "unicode/utf8",
"unicode/utf16",
- "encoding/xml",
+ "unicode/utf8",
+ "unsafe",
}
diff --git a/test/bench/garbage/stats.go b/test/bench/garbage/stats.go
index cdcb32f9b..6dc0aeb23 100644
--- a/test/bench/garbage/stats.go
+++ b/test/bench/garbage/stats.go
@@ -14,16 +14,21 @@ import (
func gcstats(name string, n int, t time.Duration) {
st := new(runtime.MemStats)
runtime.ReadMemStats(st)
- fmt.Printf("garbage.%sMem Alloc=%d/%d Heap=%d NextGC=%d Mallocs=%d\n", name, st.Alloc, st.TotalAlloc, st.Sys, st.NextGC, st.Mallocs)
- fmt.Printf("garbage.%s %d %d ns/op\n", name, n, t.Nanoseconds()/int64(n))
- fmt.Printf("garbage.%sLastPause 1 %d ns/op\n", name, st.PauseNs[(st.NumGC-1)%uint32(len(st.PauseNs))])
- fmt.Printf("garbage.%sPause %d %d ns/op\n", name, st.NumGC, int64(st.PauseTotalNs)/int64(st.NumGC))
+ nprocs := runtime.GOMAXPROCS(-1)
+ cpus := ""
+ if nprocs != 1 {
+ cpus = fmt.Sprintf("-%d", nprocs)
+ }
+ fmt.Printf("garbage.%sMem%s Alloc=%d/%d Heap=%d NextGC=%d Mallocs=%d\n", name, cpus, st.Alloc, st.TotalAlloc, st.Sys, st.NextGC, st.Mallocs)
+ fmt.Printf("garbage.%s%s %d %d ns/op\n", name, cpus, n, t.Nanoseconds()/int64(n))
+ fmt.Printf("garbage.%sLastPause%s 1 %d ns/op\n", name, cpus, st.PauseNs[(st.NumGC-1)%uint32(len(st.PauseNs))])
+ fmt.Printf("garbage.%sPause%s %d %d ns/op\n", name, cpus, st.NumGC, int64(st.PauseTotalNs)/int64(st.NumGC))
nn := int(st.NumGC)
if nn >= len(st.PauseNs) {
nn = len(st.PauseNs)
}
t1, t2, t3, t4, t5 := tukey5(st.PauseNs[0:nn])
- fmt.Printf("garbage.%sPause5: %d %d %d %d %d\n", name, t1, t2, t3, t4, t5)
+ fmt.Printf("garbage.%sPause5%s: %d %d %d %d %d\n", name, cpus, t1, t2, t3, t4, t5)
// fmt.Printf("garbage.%sScan: %v\n", name, st.ScanDist)
}
diff --git a/test/bench/garbage/tree2.go b/test/bench/garbage/tree2.go
index 3db0a0ba3..a171c696b 100644
--- a/test/bench/garbage/tree2.go
+++ b/test/bench/garbage/tree2.go
@@ -11,6 +11,7 @@ import (
"os"
"runtime"
"runtime/pprof"
+ "time"
"unsafe"
)
@@ -83,7 +84,12 @@ func main() {
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
- for i := 0; i < 10; i++ {
+ const N = 10
+ var t0 time.Time
+ for i := 0; i < N; i++ {
+ t0 = time.Now()
gc()
}
+ // Standard gotest benchmark output, collected by build dashboard.
+ gcstats("BenchmarkTree2", N, time.Now().Sub(t0))
}