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
b2127a6c
Commit
b2127a6c
authored
Jun 29, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing: make ResetTimer not start/stop the timer
R=r CC=golang-dev
https://golang.org/cl/4626085
parent
25733a94
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
benchmark.go
src/pkg/testing/benchmark.go
+10
-3
No files found.
src/pkg/testing/benchmark.go
View file @
b2127a6c
...
...
@@ -35,7 +35,11 @@ type B struct {
// StartTimer starts timing a test. This function is called automatically
// before a benchmark starts, but it can also used to resume timing after
// a call to StopTimer.
func
(
b
*
B
)
StartTimer
()
{
b
.
start
=
time
.
Nanoseconds
()
}
func
(
b
*
B
)
StartTimer
()
{
if
b
.
start
==
0
{
b
.
start
=
time
.
Nanoseconds
()
}
}
// StopTimer stops timing a test. This can be used to pause the timer
// while performing complex initialization that you don't
...
...
@@ -47,9 +51,12 @@ func (b *B) StopTimer() {
b
.
start
=
0
}
// ResetTimer stops the timer and sets the elapsed benchmark time to zero.
// ResetTimer sets the elapsed benchmark time to zero.
// It does not affect whether the timer is running.
func
(
b
*
B
)
ResetTimer
()
{
b
.
start
=
0
if
b
.
start
>
0
{
b
.
start
=
time
.
Nanoseconds
()
}
b
.
ns
=
0
}
...
...
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