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

Delta Between Two Patch Sets: test/scale/goroutine.go

Issue 4644051: code review 4644051: test: A set of scalability benchmarks. (Closed)
Left Patch Set: diff -r 6f1145ee588d https://go.googlecode.com/hg/ Created 12 years, 9 months ago
Right Patch Set: diff -r 6f1145ee588d https://go.googlecode.com/hg/ Created 12 years, 9 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/scale/driver.go ('k') | test/scale/matmult.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
5 // Tests goroutine creation/completion performance/scalability.
6 // Spawns a lot of goroutines concurrently. goroutine-centr test uses single ato mic
7 // variable to track when all the goroutines are created and executed (this sing le
8 // var can hinder scalability). goroutine-distr test uses distributed variables
9 // to track completion (it does not create scalability bottleneck, but puts addi tional
10 // pressure onto GC).
11 // Expected to scale almost linearly.
4 12
5 package main 13 package main
6 14
7 import ( 15 import (
8 "container/vector" 16 "container/vector"
9 "runtime" 17 "runtime"
10 "sync/atomic" 18 "sync/atomic"
11 ) 19 )
12 20
13 const ( 21 const (
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 runtime.Gosched() 64 runtime.Gosched()
57 } 65 }
58 totalWork += COUNT 66 totalWork += COUNT
59 } 67 }
60 } 68 }
61 69
62 func SuiteGoroutine(benchmarks *vector.Vector) { 70 func SuiteGoroutine(benchmarks *vector.Vector) {
63 benchmarks.Push(&Benchmark{"goroutine-distr", benchmarkGorotuineDistribu ted}) 71 benchmarks.Push(&Benchmark{"goroutine-distr", benchmarkGorotuineDistribu ted})
64 benchmarks.Push(&Benchmark{"goroutine-centr", benchmarkGorotuineCentrali zed}) 72 benchmarks.Push(&Benchmark{"goroutine-centr", benchmarkGorotuineCentrali zed})
65 } 73 }
LEFTRIGHT

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