diff options
author | Russ Cox <rsc@golang.org> | 2010-02-03 16:31:34 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-02-03 16:31:34 -0800 |
commit | 3732daa8e7c635ba306dd923a4342650524320df (patch) | |
tree | 31d454f4c7a1d0189ddbd9b1e771c8716655dc72 /src/pkg/fmt/fmt_test.go | |
parent | 9c681e46bfdf7a2745d2df35412592e8c13e0fce (diff) | |
download | golang-3732daa8e7c635ba306dd923a4342650524320df.tar.gz |
finalizers; merge package malloc into package runtime
R=r, cw
CC=golang-dev
http://codereview.appspot.com/198085
Diffstat (limited to 'src/pkg/fmt/fmt_test.go')
-rw-r--r-- | src/pkg/fmt/fmt_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/pkg/fmt/fmt_test.go b/src/pkg/fmt/fmt_test.go index c89a6acac..ecceeb09c 100644 --- a/src/pkg/fmt/fmt_test.go +++ b/src/pkg/fmt/fmt_test.go @@ -7,8 +7,8 @@ package fmt_test import ( . "fmt" "io" - "malloc" // for the malloc count test only "math" + "runtime" // for the malloc count test only "strings" "testing" ) @@ -281,29 +281,29 @@ func BenchmarkSprintfIntInt(b *testing.B) { } func TestCountMallocs(t *testing.T) { - mallocs := 0 - malloc.GetStats().Mallocs + mallocs := 0 - runtime.MemStats.Mallocs for i := 0; i < 100; i++ { Sprintf("") } - mallocs += malloc.GetStats().Mallocs + mallocs += runtime.MemStats.Mallocs Printf("mallocs per Sprintf(\"\"): %d\n", mallocs/100) - mallocs = 0 - malloc.GetStats().Mallocs + mallocs = 0 - runtime.MemStats.Mallocs for i := 0; i < 100; i++ { Sprintf("xxx") } - mallocs += malloc.GetStats().Mallocs + mallocs += runtime.MemStats.Mallocs Printf("mallocs per Sprintf(\"xxx\"): %d\n", mallocs/100) - mallocs = 0 - malloc.GetStats().Mallocs + mallocs = 0 - runtime.MemStats.Mallocs for i := 0; i < 100; i++ { Sprintf("%x", i) } - mallocs += malloc.GetStats().Mallocs + mallocs += runtime.MemStats.Mallocs Printf("mallocs per Sprintf(\"%%x\"): %d\n", mallocs/100) - mallocs = 0 - malloc.GetStats().Mallocs + mallocs = 0 - runtime.MemStats.Mallocs for i := 0; i < 100; i++ { Sprintf("%x %x", i, i) } - mallocs += malloc.GetStats().Mallocs + mallocs += runtime.MemStats.Mallocs Printf("mallocs per Sprintf(\"%%x %%x\"): %d\n", mallocs/100) } |