Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
a503084a
Commit
a503084a
authored
Jul 04, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ca3c4e76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
72 deletions
+63
-72
go/xcommon/tracing/cmd/gotrace/gotrace.go
go/xcommon/tracing/cmd/gotrace/gotrace.go
+3
-72
go/xcommon/tracing/cmd/gotrace/util.go
go/xcommon/tracing/cmd/gotrace/util.go
+60
-0
No files found.
go/xcommon/tracing/cmd/gotrace/gotrace.go
View file @
a503084a
...
...
@@ -30,7 +30,6 @@ package main
import
(
"bufio"
"bytes"
"flag"
"fmt"
"go/ast"
...
...
@@ -468,77 +467,9 @@ func removeFile(path string) error {
return
err
}
// Buffer is bytes.Buffer + syntatic sugar
type
Buffer
struct
{
bytes
.
Buffer
}
func
(
b
*
Buffer
)
emit
(
format
string
,
argv
...
interface
{})
{
fmt
.
Fprintf
(
b
,
format
+
"
\n
"
,
argv
...
)
}
// StrSet is set<string>
type
StrSet
map
[
string
]
struct
{}
func
(
s
StrSet
)
Add
(
itemv
...
string
)
{
for
_
,
item
:=
range
itemv
{
s
[
item
]
=
struct
{}{}
}
}
func
(
s
StrSet
)
Delete
(
item
string
)
{
delete
(
s
,
item
)
}
// Itemv returns ordered slice of set items
func
(
s
StrSet
)
Itemv
()
[]
string
{
itemv
:=
make
([]
string
,
0
,
len
(
s
))
for
item
:=
range
s
{
itemv
=
append
(
itemv
,
item
)
}
sort
.
Strings
(
itemv
)
return
itemv
}
/*
// findPackageNoZTrace is (*build.Context).Import but filters-out ztrace* files from found package
//
// we don't load what should be generated by us for 2 reasons:
// - code generated could be wrong with older version of the
// tool - it should not prevent from regenerating.
// - generated code imports packages which might be not there
// yet in gopath (lab.nexedi.com/kirr/go123/tracing)
func findPackageNoZTrace(ctxt *build.Context, importPath, fromDir string, mode build.ImportMode) (*build.Package, error) {
bp, err := ctxt.Import(importPath, fromDir, mode)
filter := func(filev *[]string) {
var okv []string
for _, f := range *filev {
if strings.HasPrefix(f, "ztrace") {
bp.IgnoredGoFiles = append(bp.IgnoredGoFiles, f)
} else {
okv = append(okv, f)
}
}
*filev = okv
}
if bp != nil {
filter(&bp.GoFiles)
filter(&bp.CgoFiles)
filter(&bp.TestGoFiles)
filter(&bp.XTestGoFiles)
filter(&bp.SFiles)
// XXX also adjust .Import{s,Pos}, .TestImport{s,Pos}, .XTestImport{s,Pos} ?
}
return bp, err
}
*/
// Program represents loaded program for tracepoint analysis
// It is generalization of loader.Program due to loader not allowing to
// construct programs incrementally.
type
Program
struct
{
// list of loader.Programs in use
//
...
...
go/xcommon/tracing/cmd/gotrace/util.go
0 → 100644
View file @
a503084a
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
package
main
// misc utilities
import
(
"bytes"
"fmt"
"sort"
)
// Buffer is bytes.Buffer + syntatic sugar
type
Buffer
struct
{
bytes
.
Buffer
}
func
(
b
*
Buffer
)
emit
(
format
string
,
argv
...
interface
{})
{
fmt
.
Fprintf
(
b
,
format
+
"
\n
"
,
argv
...
)
}
// StrSet is set<string>
type
StrSet
map
[
string
]
struct
{}
func
(
s
StrSet
)
Add
(
itemv
...
string
)
{
for
_
,
item
:=
range
itemv
{
s
[
item
]
=
struct
{}{}
}
}
func
(
s
StrSet
)
Delete
(
item
string
)
{
delete
(
s
,
item
)
}
// Itemv returns ordered slice of set items
func
(
s
StrSet
)
Itemv
()
[]
string
{
itemv
:=
make
([]
string
,
0
,
len
(
s
))
for
item
:=
range
s
{
itemv
=
append
(
itemv
,
item
)
}
sort
.
Strings
(
itemv
)
return
itemv
}
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