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

Side by Side Diff: src/pkg/runtime/gc_test.go

Issue 128380043: code review 128380043: runtime: fix MemStats on 32-bits (Closed)
Patch Set: diff -r 40ba12acfb6a873bab35d63ca1198d5f5e486482 https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 7 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:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/runtime/malloc.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 runtime_test 5 package runtime_test
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 "runtime" 9 "runtime"
10 "runtime/debug" 10 "runtime/debug"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 func TestGcLastTime(t *testing.T) { 157 func TestGcLastTime(t *testing.T) {
158 ms := new(runtime.MemStats) 158 ms := new(runtime.MemStats)
159 t0 := time.Now().UnixNano() 159 t0 := time.Now().UnixNano()
160 runtime.GC() 160 runtime.GC()
161 t1 := time.Now().UnixNano() 161 t1 := time.Now().UnixNano()
162 runtime.ReadMemStats(ms) 162 runtime.ReadMemStats(ms)
163 last := int64(ms.LastGC) 163 last := int64(ms.LastGC)
164 if t0 > last || last > t1 { 164 if t0 > last || last > t1 {
165 t.Fatalf("bad last GC time: got %v, want [%v, %v]", last, t0, t1 ) 165 t.Fatalf("bad last GC time: got %v, want [%v, %v]", last, t0, t1 )
166 } 166 }
167 pause := ms.PauseNs[(ms.NumGC+255)%256]
168 if pause == 0 || pause > 10e9 {
169 t.Fatalf("bad last GC pause: got %v, want [0, 10e9]", pause)
170 }
167 } 171 }
168 172
169 var hugeSink interface{} 173 var hugeSink interface{}
170 174
171 func TestHugeGCInfo(t *testing.T) { 175 func TestHugeGCInfo(t *testing.T) {
172 // The test ensures that compiler can chew these huge types even on weak est machines. 176 // The test ensures that compiler can chew these huge types even on weak est machines.
173 // The types are not allocated at runtime. 177 // The types are not allocated at runtime.
174 if hugeSink != nil { 178 if hugeSink != nil {
175 // 400MB on 32 bots, 4TB on 64-bits. 179 // 400MB on 32 bots, 4TB on 64-bits.
176 const n = (400 << 20) + (unsafe.Sizeof(uintptr(0))-4)<<40 180 const n = (400 << 20) + (unsafe.Sizeof(uintptr(0))-4)<<40
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 279 }
276 } 280 }
277 }() 281 }()
278 for i := 0; i < 1e4; i++ { 282 for i := 0; i < 1e4; i++ {
279 func() { 283 func() {
280 defer print("") 284 defer print("")
281 }() 285 }()
282 } 286 }
283 close(done) 287 close(done)
284 } 288 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/runtime/malloc.go » ('j') | no next file with comments »

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