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
79928d00
Commit
79928d00
authored
Jul 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a87dac1b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
5 deletions
+127
-5
go/xcommon/tracing/cmd/gotrace/gotrace.go
go/xcommon/tracing/cmd/gotrace/gotrace.go
+3
-4
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
+3
-0
go/xcommon/tracing/cmd/gotrace/testdata/src/a/pkg1/pkg1.go
go/xcommon/tracing/cmd/gotrace/testdata/src/a/pkg1/pkg1.go
+2
-1
go/xcommon/tracing/cmd/gotrace/testdata/src/a/pkg1/ztrace.go.ok
...mmon/tracing/cmd/gotrace/testdata/src/a/pkg1/ztrace.go.ok
+119
-0
No files found.
go/xcommon/tracing/cmd/gotrace/gotrace.go
View file @
79928d00
...
...
@@ -148,9 +148,9 @@ func (p *Package) parseTraceEvent(srcfile *ast.File, pos token.Position, text st
// now parse/typecheck
filename
:=
fmt
.
Sprintf
(
"%v:%v+trace:event %v"
,
pos
.
Filename
,
pos
.
Line
,
text
)
println
(
"---- 8< ----"
,
filename
)
println
(
buf
.
String
())
println
(
"---- 8< ----"
)
//
println("---- 8< ----", filename)
//
println(buf.String())
//
println("---- 8< ----")
tf
,
err
:=
parser
.
ParseFile
(
p
.
traceFset
,
filename
,
buf
.
String
(),
0
)
fmt
.
Println
(
"parse:"
,
err
)
if
err
!=
nil
{
...
...
@@ -218,7 +218,6 @@ func packageTrace(prog *loader.Program, pkgi *loader.PackageInfo) (*Package, err
}
// preload original package files into tracing package
fmt
.
Println
(
"FFF"
,
p
.
Pkgi
.
Files
)
err
:=
p
.
traceChecker
.
Files
(
p
.
Pkgi
.
Files
)
if
err
!=
nil
{
// must not happen
...
...
go/xcommon/tracing/cmd/gotrace/gotrace_test.go
View file @
79928d00
...
...
@@ -50,6 +50,9 @@ func prepareTestTree(src, dst string, mode TreePrepareMode) error {
return
err
}
// NOTE since files are walked in lexical order <f>.ok or
// <f>.rm is always guaranteed to go after <f>.
var
isOk
,
isRm
bool
if
strings
.
HasSuffix
(
srcpath
,
".ok"
)
{
isOk
=
true
...
...
go/xcommon/tracing/cmd/gotrace/testdata/src/a/pkg1/pkg1.go
View file @
79928d00
...
...
@@ -45,4 +45,5 @@ func DoSomething(topic string) {
// XXX do we need vvv ?
// package-local non-exported tracepoint
//trace:event tracedoSomethingLocal(topic string)
//type t struct {}
////trace:event tracedoSomethingLocal(arg *t)
go/xcommon/tracing/cmd/gotrace/testdata/src/a/pkg1/ztrace.go.ok
0 → 100644
View file @
79928d00
//
Code
generated
by
lab
.
nexedi
.
com
/
kirr
/
go123
/
tracing
/
cmd
/
gotrace
;
DO
NOT
EDIT
.
package
pkg1
//
code
generated
for
tracepoints
import
(
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
"unsafe"
"net/url"
)
//
traceevent
:
traceDoSomething
(
topic
string
)
XXX
better
raw
.
Text
(
e
.
g
.
comments
)
type
_t_traceDoSomething
struct
{
tracing
.
Probe
probefunc
func
(
topic
string
)
}
var
_traceDoSomething
*
_t_traceDoSomething
func
traceDoSomething
(
topic
string
)
{
if
_traceDoSomething
!= nil {
_traceDoSomething_run
(
topic
)
}
}
func
_traceDoSomething_run
(
topic
string
)
{
for
p
:=
_traceDoSomething
;
p
!= nil; p = (*_t_traceDoSomething)(unsafe.Pointer(p.Next())) {
p
.
probefunc
(
topic
)
}
}
func
traceDoSomething_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
topic
string
))
*
tracing
.
Probe
{
p
:=
_t_traceDoSomething
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(**
tracing
.
Probe
)(
unsafe
.
Pointer
(&
_traceDoSomething
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
//
traceevent
:
traceNewT
(
t
*
T
)
XXX
better
raw
.
Text
(
e
.
g
.
comments
)
type
_t_traceNewT
struct
{
tracing
.
Probe
probefunc
func
(
t
*
T
)
}
var
_traceNewT
*
_t_traceNewT
func
traceNewT
(
t
*
T
)
{
if
_traceNewT
!= nil {
_traceNewT_run
(
t
)
}
}
func
_traceNewT_run
(
t
*
T
)
{
for
p
:=
_traceNewT
;
p
!= nil; p = (*_t_traceNewT)(unsafe.Pointer(p.Next())) {
p
.
probefunc
(
t
)
}
}
func
traceNewT_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
t
*
T
))
*
tracing
.
Probe
{
p
:=
_t_traceNewT
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(**
tracing
.
Probe
)(
unsafe
.
Pointer
(&
_traceNewT
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
//
traceevent
:
traceNewTPre
()
XXX
better
raw
.
Text
(
e
.
g
.
comments
)
type
_t_traceNewTPre
struct
{
tracing
.
Probe
probefunc
func
()
}
var
_traceNewTPre
*
_t_traceNewTPre
func
traceNewTPre
()
{
if
_traceNewTPre
!= nil {
_traceNewTPre_run
()
}
}
func
_traceNewTPre_run
()
{
for
p
:=
_traceNewTPre
;
p
!= nil; p = (*_t_traceNewTPre)(unsafe.Pointer(p.Next())) {
p
.
probefunc
()
}
}
func
traceNewTPre_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
())
*
tracing
.
Probe
{
p
:=
_t_traceNewTPre
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(**
tracing
.
Probe
)(
unsafe
.
Pointer
(&
_traceNewTPre
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
//
traceevent
:
traceURLParsed
(
u
*
url
.
URL
)
XXX
better
raw
.
Text
(
e
.
g
.
comments
)
type
_t_traceURLParsed
struct
{
tracing
.
Probe
probefunc
func
(
u
*
url
.
URL
)
}
var
_traceURLParsed
*
_t_traceURLParsed
func
traceURLParsed
(
u
*
url
.
URL
)
{
if
_traceURLParsed
!= nil {
_traceURLParsed_run
(
u
)
}
}
func
_traceURLParsed_run
(
u
*
url
.
URL
)
{
for
p
:=
_traceURLParsed
;
p
!= nil; p = (*_t_traceURLParsed)(unsafe.Pointer(p.Next())) {
p
.
probefunc
(
u
)
}
}
func
traceURLParsed_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
u
*
url
.
URL
))
*
tracing
.
Probe
{
p
:=
_t_traceURLParsed
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(**
tracing
.
Probe
)(
unsafe
.
Pointer
(&
_traceURLParsed
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
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