Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c7dea44a
Commit
c7dea44a
authored
Feb 14, 2018
by
Marcin Owsiany
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add golang.org/x/tools/benchmark/parse godep.
parent
93d8bf34
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
193 additions
and
0 deletions
+193
-0
Godeps.json
Godeps/Godeps.json
+4
-0
LICENSES
Godeps/LICENSES
+35
-0
BUILD
vendor/BUILD
+1
-0
BUILD
vendor/golang.org/x/tools/benchmark/parse/BUILD
+22
-0
parse.go
vendor/golang.org/x/tools/benchmark/parse/parse.go
+131
-0
No files found.
Godeps/Godeps.json
View file @
c7dea44a
...
@@ -2993,6 +2993,10 @@
...
@@ -2993,6 +2993,10 @@
"Rev"
:
"f51c12702a4d776e4c1fa9b0fabab841babae631"
"Rev"
:
"f51c12702a4d776e4c1fa9b0fabab841babae631"
},
},
{
{
"ImportPath"
:
"golang.org/x/tools/benchmark/parse"
,
"Rev"
:
"2382e3994d48b1d22acc2c86bcad0a2aff028e32"
},
{
"ImportPath"
:
"golang.org/x/tools/container/intsets"
,
"ImportPath"
:
"golang.org/x/tools/container/intsets"
,
"Rev"
:
"2382e3994d48b1d22acc2c86bcad0a2aff028e32"
"Rev"
:
"2382e3994d48b1d22acc2c86bcad0a2aff028e32"
},
},
...
...
Godeps/LICENSES
View file @
c7dea44a
...
@@ -90222,6 +90222,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -90222,6 +90222,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
================================================================================
= vendor/golang.org/x/tools/benchmark/parse licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
= vendor/golang.org/x/tools/LICENSE 5d4950ecb7b26d2c5e4e7b4e0dd74707
================================================================================
================================================================================
= vendor/golang.org/x/tools/container/intsets licensed under: =
= vendor/golang.org/x/tools/container/intsets licensed under: =
Copyright (c) 2009 The Go Authors. All rights reserved.
Copyright (c) 2009 The Go Authors. All rights reserved.
vendor/BUILD
View file @
c7dea44a
...
@@ -387,6 +387,7 @@ filegroup(
...
@@ -387,6 +387,7 @@ filegroup(
"//vendor/golang.org/x/text/unicode/norm:all-srcs",
"//vendor/golang.org/x/text/unicode/norm:all-srcs",
"//vendor/golang.org/x/text/width:all-srcs",
"//vendor/golang.org/x/text/width:all-srcs",
"//vendor/golang.org/x/time/rate:all-srcs",
"//vendor/golang.org/x/time/rate:all-srcs",
"//vendor/golang.org/x/tools/benchmark/parse:all-srcs",
"//vendor/golang.org/x/tools/container/intsets:all-srcs",
"//vendor/golang.org/x/tools/container/intsets:all-srcs",
"//vendor/golang.org/x/tools/go/ast/astutil:all-srcs",
"//vendor/golang.org/x/tools/go/ast/astutil:all-srcs",
"//vendor/golang.org/x/tools/go/vcs:all-srcs",
"//vendor/golang.org/x/tools/go/vcs:all-srcs",
...
...
vendor/golang.org/x/tools/benchmark/parse/BUILD
0 → 100644
View file @
c7dea44a
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["parse.go"],
importpath = "golang.org/x/tools/benchmark/parse",
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
vendor/golang.org/x/tools/benchmark/parse/parse.go
0 → 100644
View file @
c7dea44a
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package parse provides support for parsing benchmark results as
// generated by 'go test -bench'.
package
parse
import
(
"bufio"
"bytes"
"fmt"
"io"
"strconv"
"strings"
)
// Flags used by Benchmark.Measured to indicate
// which measurements a Benchmark contains.
const
(
NsPerOp
=
1
<<
iota
MBPerS
AllocedBytesPerOp
AllocsPerOp
)
// Benchmark is one run of a single benchmark.
type
Benchmark
struct
{
Name
string
// benchmark name
N
int
// number of iterations
NsPerOp
float64
// nanoseconds per iteration
AllocedBytesPerOp
uint64
// bytes allocated per iteration
AllocsPerOp
uint64
// allocs per iteration
MBPerS
float64
// MB processed per second
Measured
int
// which measurements were recorded
Ord
int
// ordinal position within a benchmark run
}
// ParseLine extracts a Benchmark from a single line of testing.B
// output.
func
ParseLine
(
line
string
)
(
*
Benchmark
,
error
)
{
fields
:=
strings
.
Fields
(
line
)
// Two required, positional fields: Name and iterations.
if
len
(
fields
)
<
2
{
return
nil
,
fmt
.
Errorf
(
"two fields required, have %d"
,
len
(
fields
))
}
if
!
strings
.
HasPrefix
(
fields
[
0
],
"Benchmark"
)
{
return
nil
,
fmt
.
Errorf
(
`first field does not start with "Benchmark"`
)
}
n
,
err
:=
strconv
.
Atoi
(
fields
[
1
])
if
err
!=
nil
{
return
nil
,
err
}
b
:=
&
Benchmark
{
Name
:
fields
[
0
],
N
:
n
}
// Parse any remaining pairs of fields; we've parsed one pair already.
for
i
:=
1
;
i
<
len
(
fields
)
/
2
;
i
++
{
b
.
parseMeasurement
(
fields
[
i
*
2
],
fields
[
i
*
2
+
1
])
}
return
b
,
nil
}
func
(
b
*
Benchmark
)
parseMeasurement
(
quant
string
,
unit
string
)
{
switch
unit
{
case
"ns/op"
:
if
f
,
err
:=
strconv
.
ParseFloat
(
quant
,
64
);
err
==
nil
{
b
.
NsPerOp
=
f
b
.
Measured
|=
NsPerOp
}
case
"MB/s"
:
if
f
,
err
:=
strconv
.
ParseFloat
(
quant
,
64
);
err
==
nil
{
b
.
MBPerS
=
f
b
.
Measured
|=
MBPerS
}
case
"B/op"
:
if
i
,
err
:=
strconv
.
ParseUint
(
quant
,
10
,
64
);
err
==
nil
{
b
.
AllocedBytesPerOp
=
i
b
.
Measured
|=
AllocedBytesPerOp
}
case
"allocs/op"
:
if
i
,
err
:=
strconv
.
ParseUint
(
quant
,
10
,
64
);
err
==
nil
{
b
.
AllocsPerOp
=
i
b
.
Measured
|=
AllocsPerOp
}
}
}
func
(
b
*
Benchmark
)
String
()
string
{
buf
:=
new
(
bytes
.
Buffer
)
fmt
.
Fprintf
(
buf
,
"%s %d"
,
b
.
Name
,
b
.
N
)
if
(
b
.
Measured
&
NsPerOp
)
!=
0
{
fmt
.
Fprintf
(
buf
,
" %.2f ns/op"
,
b
.
NsPerOp
)
}
if
(
b
.
Measured
&
MBPerS
)
!=
0
{
fmt
.
Fprintf
(
buf
,
" %.2f MB/s"
,
b
.
MBPerS
)
}
if
(
b
.
Measured
&
AllocedBytesPerOp
)
!=
0
{
fmt
.
Fprintf
(
buf
,
" %d B/op"
,
b
.
AllocedBytesPerOp
)
}
if
(
b
.
Measured
&
AllocsPerOp
)
!=
0
{
fmt
.
Fprintf
(
buf
,
" %d allocs/op"
,
b
.
AllocsPerOp
)
}
return
buf
.
String
()
}
// Set is a collection of benchmarks from one
// testing.B run, keyed by name to facilitate comparison.
type
Set
map
[
string
][]
*
Benchmark
// ParseSet extracts a Set from testing.B output.
// ParseSet preserves the order of benchmarks that have identical
// names.
func
ParseSet
(
r
io
.
Reader
)
(
Set
,
error
)
{
bb
:=
make
(
Set
)
scan
:=
bufio
.
NewScanner
(
r
)
ord
:=
0
for
scan
.
Scan
()
{
if
b
,
err
:=
ParseLine
(
scan
.
Text
());
err
==
nil
{
b
.
Ord
=
ord
ord
++
bb
[
b
.
Name
]
=
append
(
bb
[
b
.
Name
],
b
)
}
}
if
err
:=
scan
.
Err
();
err
!=
nil
{
return
nil
,
err
}
return
bb
,
nil
}
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