]> Cypherpunks repositories - gostls13.git/commitdiff
test/garbage: move to test/bench/garbage
authorRuss Cox <rsc@golang.org>
Tue, 13 Dec 2011 23:02:49 +0000 (18:02 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 13 Dec 2011 23:02:49 +0000 (18:02 -0500)
(These are benchmarks for the garbage collector, not tests.)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5484070

src/clean.bash
test/bench/garbage/Makefile [moved from test/garbage/Makefile with 93% similarity]
test/bench/garbage/parser.go [moved from test/garbage/parser.go with 100% similarity]
test/bench/garbage/peano.go [moved from test/garbage/peano.go with 99% similarity]
test/bench/garbage/stats.go [moved from test/garbage/stats.go with 87% similarity]
test/bench/garbage/tree.go [moved from test/garbage/tree.go with 100% similarity]
test/bench/shootout/timing.sh

index 3c6a3972d8d7e91c3a3f0e10d0e13018ff53b5de..98e1b944af00c48cbb8e5e23f8baa344bd7f0a84 100755 (executable)
@@ -24,7 +24,7 @@ for i in lib9 libbio libmach cmd pkg \
        ../misc/cgo/life ../misc/cgo/test \
        ../misc/dashboard/builder ../misc/goplay\
        ../doc/codelab/wiki\
-       ../test/bench/shootout ../test/garbage
+       ../test/bench/shootout ../test/bench/garbage
 do
        # Do not use gomake here. It may not be available.
        $MAKE -C "$GOROOT/src/$i" clean
similarity index 93%
rename from test/garbage/Makefile
rename to test/bench/garbage/Makefile
index acf98a7dc437ddb7c5a53aa487438a2acd1fa120..916add779522a279ea317fe9da4684204413a7a6 100644 (file)
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style
 # license that can be found in the LICENSE file.
 
-include ../../src/Make.inc
+include ../../../src/Make.inc
 
 ALL=\
        parser\
similarity index 99%
rename from test/garbage/peano.go
rename to test/bench/garbage/peano.go
index b4d31856126f11b444aae66af636dbd93776dfd2..231359688bb7cc427766fd4372ea65b27fa6b51d 100644 (file)
@@ -12,31 +12,25 @@ import (
        "time"
 )
 
-
 type Number struct {
        next *Number
 }
 
-
 // -------------------------------------
 // Peano primitives
 
 func zero() *Number { return nil }
 
-
 func is_zero(x *Number) bool { return x == nil }
 
-
 func add1(x *Number) *Number {
        e := new(Number)
        e.next = x
        return e
 }
 
-
 func sub1(x *Number) *Number { return x.next }
 
-
 func add(x, y *Number) *Number {
        if is_zero(y) {
                return x
@@ -45,7 +39,6 @@ func add(x, y *Number) *Number {
        return add(add1(x), sub1(y))
 }
 
-
 func mul(x, y *Number) *Number {
        if is_zero(x) || is_zero(y) {
                return zero()
@@ -54,7 +47,6 @@ func mul(x, y *Number) *Number {
        return add(mul(x, sub1(y)), x)
 }
 
-
 func fact(n *Number) *Number {
        if is_zero(n) {
                return add1(zero())
@@ -63,7 +55,6 @@ func fact(n *Number) *Number {
        return mul(fact(sub1(n)), n)
 }
 
-
 // -------------------------------------
 // Helpers to generate/count Peano integers
 
@@ -75,7 +66,6 @@ func gen(n int) *Number {
        return zero()
 }
 
-
 func count(x *Number) int {
        if is_zero(x) {
                return 0
@@ -84,7 +74,6 @@ func count(x *Number) int {
        return count(sub1(x)) + 1
 }
 
-
 func check(x *Number, expected int) {
        var c = count(x)
        if c != expected {
@@ -92,7 +81,6 @@ func check(x *Number, expected int) {
        }
 }
 
-
 // -------------------------------------
 // Test basic functionality
 
@@ -117,7 +105,6 @@ func verify() {
        check(fact(gen(5)), 120)
 }
 
-
 // -------------------------------------
 // Factorial
 
similarity index 87%
rename from test/garbage/stats.go
rename to test/bench/garbage/stats.go
index 474e6ad4abc55dd0cead932cedcdc12c5f9e1c05..aa9db1dbc3b9df99c0ad52b4902fcfe8e5729bc5 100644 (file)
@@ -22,13 +22,14 @@ func gcstats(name string, n int, t int64) {
        }
        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.%sScan: %v\n", name, st.ScanDist)
+
+       //      fmt.Printf("garbage.%sScan: %v\n", name, st.ScanDist)
 }
 
 type T []uint64
-func (t T) Len() int { return len(t) }
-func (t T) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
+
+func (t T) Len() int           { return len(t) }
+func (t T) Swap(i, j int)      { t[i], t[j] = t[j], t[i] }
 func (t T) Less(i, j int) bool { return t[i] < t[j] }
 
 func tukey5(raw []uint64) (lo, q1, q2, q3, hi uint64) {
index 473c9b312f81402c0ee72bbc2037ccf074b9a58f..3e190e15c83c3cd937c7fd1d9932a32dfb34ff82 100755 (executable)
@@ -5,7 +5,7 @@
 
 set -e
 
-eval $(gomake --no-print-directory -f ../../src/Make.inc go-env)
+eval $(gomake --no-print-directory -f ../../../src/Make.inc go-env)
 PATH=.:$PATH
 
 havegccgo=false