Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
13393fb6
Commit
13393fb6
authored
Mar 03, 2013
by
Mikio Hara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: add TCP over IPv6 benchmarks
R=golang-dev, dave CC=golang-dev
https://golang.org/cl/7433044
parent
3d50aaf4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
10 deletions
+38
-10
tcp_test.go
src/pkg/net/tcp_test.go
+38
-10
No files found.
src/pkg/net/tcp_test.go
View file @
13393fb6
...
...
@@ -11,23 +11,51 @@ import (
"time"
)
func
BenchmarkTCPOneShot
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
false
,
false
)
func
BenchmarkTCP
4
OneShot
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
false
,
false
,
"127.0.0.1:0"
)
}
func
BenchmarkTCPOneShotTimeout
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
false
,
true
)
func
BenchmarkTCP
4
OneShotTimeout
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
false
,
true
,
"127.0.0.1:0"
)
}
func
BenchmarkTCPPersistent
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
true
,
false
)
func
BenchmarkTCP
4
Persistent
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
true
,
false
,
"127.0.0.1:0"
)
}
func
BenchmarkTCPPersistentTimeout
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
true
,
true
)
func
BenchmarkTCP
4
PersistentTimeout
(
b
*
testing
.
B
)
{
benchmarkTCP
(
b
,
true
,
true
,
"127.0.0.1:0"
)
}
func
benchmarkTCP
(
b
*
testing
.
B
,
persistent
,
timeout
bool
)
{
func
BenchmarkTCP6OneShot
(
b
*
testing
.
B
)
{
if
!
supportsIPv6
{
b
.
Skip
(
"ipv6 is not supported"
)
}
benchmarkTCP
(
b
,
false
,
false
,
"[::1]:0"
)
}
func
BenchmarkTCP6OneShotTimeout
(
b
*
testing
.
B
)
{
if
!
supportsIPv6
{
b
.
Skip
(
"ipv6 is not supported"
)
}
benchmarkTCP
(
b
,
false
,
true
,
"[::1]:0"
)
}
func
BenchmarkTCP6Persistent
(
b
*
testing
.
B
)
{
if
!
supportsIPv6
{
b
.
Skip
(
"ipv6 is not supported"
)
}
benchmarkTCP
(
b
,
true
,
false
,
"[::1]:0"
)
}
func
BenchmarkTCP6PersistentTimeout
(
b
*
testing
.
B
)
{
if
!
supportsIPv6
{
b
.
Skip
(
"ipv6 is not supported"
)
}
benchmarkTCP
(
b
,
true
,
true
,
"[::1]:0"
)
}
func
benchmarkTCP
(
b
*
testing
.
B
,
persistent
,
timeout
bool
,
laddr
string
)
{
const
msgLen
=
512
conns
:=
b
.
N
numConcurrent
:=
runtime
.
GOMAXPROCS
(
-
1
)
*
16
...
...
@@ -61,7 +89,7 @@ func benchmarkTCP(b *testing.B, persistent, timeout bool) {
}
return
true
}
ln
,
err
:=
Listen
(
"tcp"
,
"127.0.0.1:0"
)
ln
,
err
:=
Listen
(
"tcp"
,
laddr
)
if
err
!=
nil
{
b
.
Fatalf
(
"Listen failed: %v"
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment