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

Delta Between Two Patch Sets: test/scale/once.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/mutex.go ('k') | test/scale/pingpong.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 sync.Once fast-path scalability under contention.
6 // A set of goroutines repeatedly execute sync.Once.Do() on a single object.
7 // Expected to scale almost linearly.
4 8
5 package main 9 package main
6 10
7 import ( 11 import (
8 "container/vector" 12 "container/vector"
9 "runtime" 13 "runtime"
10 "sync" 14 "sync"
11 ) 15 )
12 16
13 func benchmarkOnce() { 17 func benchmarkOnce() {
(...skipping 15 matching lines...) Expand all
29 }() 33 }()
30 } 34 }
31 for p := 0; p != procs; p += 1 { 35 for p := 0; p != procs; p += 1 {
32 totalWork += <-compl 36 totalWork += <-compl
33 } 37 }
34 } 38 }
35 39
36 func SuiteOnce(benchmarks *vector.Vector) { 40 func SuiteOnce(benchmarks *vector.Vector) {
37 benchmarks.Push(&Benchmark{"once", benchmarkOnce}) 41 benchmarks.Push(&Benchmark{"once", benchmarkOnce})
38 } 42 }
LEFTRIGHT

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