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
0e2c9a36
Commit
0e2c9a36
authored
Jun 27, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
36c08110
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
14 deletions
+171
-14
go/neo/trace.go
go/neo/trace.go
+4
-4
go/xcommon/tracing/cmd/gotracegen/gotracegen.go
go/xcommon/tracing/cmd/gotracegen/gotracegen.go
+22
-10
go/xcommon/xnet/pipenet/trace.go
go/xcommon/xnet/pipenet/trace.go
+145
-0
No files found.
go/neo/trace.go
View file @
0e2c9a36
// Code generated by lab.nexedi.com/kirr/go123/tracing/cmd/gotrace; DO NOT EDIT.
// Code generated by lab.nexedi.com/kirr/go123/tracing/cmd/gotrace; DO NOT EDIT.
package
0x5f45c0
package
neo
import
(
import
(
lab
.
nexedi
.
com
/
kirr
/
neo
/
go
/
xcommon
/
tracing
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
)
)
// traceevent: traceConnRecv(c *Conn, msg Msg) XXX better raw .Text (e.g. comments)
// traceevent: traceConnRecv(c *Conn, msg Msg) XXX better raw .Text (e.g. comments)
...
@@ -29,7 +29,7 @@ func _traceConnRecv_run(c, msg) {
...
@@ -29,7 +29,7 @@ func _traceConnRecv_run(c, msg) {
func
traceConnRecv_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
c
*
Conn
,
msg
Msg
))
*
tracing
.
Probe
{
func
traceConnRecv_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
c
*
Conn
,
msg
Msg
))
*
tracing
.
Probe
{
p
:=
_t_traceConnRecv
{
probefunc
:
probe
}
p
:=
_t_traceConnRecv
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceConnRecv
),
&
p
.
Probe
)
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceConnRecv
),
&
p
.
Probe
)
)
return
&
p
.
Probe
return
&
p
.
Probe
}
}
...
@@ -56,7 +56,7 @@ func _traceConnSend_run(c, msg) {
...
@@ -56,7 +56,7 @@ func _traceConnSend_run(c, msg) {
func
traceConnSend_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
c
*
Conn
,
msg
Msg
))
*
tracing
.
Probe
{
func
traceConnSend_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
c
*
Conn
,
msg
Msg
))
*
tracing
.
Probe
{
p
:=
_t_traceConnSend
{
probefunc
:
probe
}
p
:=
_t_traceConnSend
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceConnSend
),
&
p
.
Probe
)
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceConnSend
),
&
p
.
Probe
)
)
return
&
p
.
Probe
return
&
p
.
Probe
}
}
...
...
go/xcommon/tracing/cmd/gotracegen/gotracegen.go
View file @
0e2c9a36
...
@@ -240,7 +240,7 @@ func {{.Name}}({{.TypedArgv}}) {
...
@@ -240,7 +240,7 @@ func {{.Name}}({{.TypedArgv}}) {
}
}
{{/* function to notify attached probes */ -}}
{{/* function to notify attached probes */ -}}
func _{{.Name}}_run({{.Argv}}) {
func _{{.Name}}_run({{.
Typed
Argv}}) {
for p := _{{.Name}}; p != nil; p = (*_t_{{.Name}})(unsafe.Pointer(p.Next())) {
for p := _{{.Name}}; p != nil; p = (*_t_{{.Name}})(unsafe.Pointer(p.Next())) {
p.probefunc({{.Argv}})
p.probefunc({{.Argv}})
}
}
...
@@ -249,7 +249,7 @@ func _{{.Name}}_run({{.Argv}}) {
...
@@ -249,7 +249,7 @@ func _{{.Name}}_run({{.Argv}}) {
{{/* function to attach a probe to tracepoint */ -}}
{{/* function to attach a probe to tracepoint */ -}}
func {{.Name}}_Attach(pg *tracing.ProbeGroup, probe func({{.TypedArgv}})) *tracing.Probe {
func {{.Name}}_Attach(pg *tracing.ProbeGroup, probe func({{.TypedArgv}})) *tracing.Probe {
p := _t_{{.Name}}{probefunc: probe}
p := _t_{{.Name}}{probefunc: probe}
tracing.AttachProbe(pg, (**tracing.Probe)(unsafe.Pointer(&_{{.Name}}), &p.Probe)
tracing.AttachProbe(pg, (**tracing.Probe)(unsafe.Pointer(&_{{.Name}})
)
, &p.Probe)
return &p.Probe
return &p.Probe
}
}
`
))
`
))
...
@@ -315,6 +315,7 @@ func tracegen(pkgpath string) error {
...
@@ -315,6 +315,7 @@ func tracegen(pkgpath string) error {
conf
.
Import
(
pkgpath
)
conf
.
Import
(
pkgpath
)
// load package + all its imports
// load package + all its imports
// XXX ignore trace.go & trace.s on load here?
lprog
,
err
:=
conf
.
Load
()
lprog
,
err
:=
conf
.
Load
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
...
@@ -339,9 +340,11 @@ func tracegen(pkgpath string) error {
...
@@ -339,9 +340,11 @@ func tracegen(pkgpath string) error {
// prologue
// prologue
buf
.
WriteString
(
magic
)
buf
.
WriteString
(
magic
)
buf
.
emit
(
"
\n
package %v"
,
pkg
.
Pkgi
.
Pkg
.
Name
)
buf
.
emit
(
"
\n
package %v"
,
pkg
.
Pkgi
.
Pkg
.
Name
())
buf
.
emit
(
"// code generated for tracepoints"
)
buf
.
emit
(
"
\n
import ("
)
buf
.
emit
(
"
\n
import ("
)
buf
.
emit
(
"
\t\t
lab.nexedi.com/kirr/neo/go/xcommon/tracing"
)
buf
.
emit
(
"
\t\t
%q"
,
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
)
buf
.
emit
(
"
\t\t
%q"
,
"unsafe"
)
// TODO import all packages for used types
// TODO import all packages for used types
buf
.
emit
(
")"
)
buf
.
emit
(
")"
)
...
@@ -360,15 +363,15 @@ func tracegen(pkgpath string) error {
...
@@ -360,15 +363,15 @@ func tracegen(pkgpath string) error {
for
_
,
timport
:=
range
pkg
.
Importv
{
for
_
,
timport
:=
range
pkg
.
Importv
{
buf
.
emit
(
"// traceimport: %v"
,
timport
.
PkgPath
)
buf
.
emit
(
"// traceimport: %v"
,
timport
.
PkgPath
)
pkgi
=
lprog
.
Package
(
timport
.
PkgPath
)
impPkgi
:
=
lprog
.
Package
(
timport
.
PkgPath
)
if
p
kgi
==
nil
{
if
impP
kgi
==
nil
{
// TODO do not require vvv
// TODO do not require vvv
log
.
Fatalf
(
"%v: package %s must be also regularly imported"
,
timport
.
Pos
,
timport
.
PkgPath
)
log
.
Fatalf
(
"%v: package %s must be also regularly imported"
,
timport
.
Pos
,
timport
.
PkgPath
)
}
}
pkg
=
packageTrace
(
lprog
,
p
kgi
)
impPkg
:=
packageTrace
(
lprog
,
impP
kgi
)
for
_
,
event
:=
range
p
kg
.
Eventv
{
for
_
,
event
:=
range
impP
kg
.
Eventv
{
err
=
traceEventImportTmpl
.
Execute
(
buf
,
event
)
err
=
traceEventImportTmpl
.
Execute
(
buf
,
event
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
// XXX
panic
(
err
)
// XXX
...
@@ -385,16 +388,25 @@ func tracegen(pkgpath string) error {
...
@@ -385,16 +388,25 @@ func tracegen(pkgpath string) error {
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
// XXX vvv needed only if there are trace imports
// write empty trace.s so go:linkname works
// write empty trace.s so go:linkname works
buf
.
Reset
()
buf
.
Reset
()
buf
.
WriteString
(
magic
)
buf
.
WriteString
(
magic
)
buf
.
emit
(
"// empty .s so `go build` does not use -complete for go:linkname to work"
)
buf
.
emit
(
"// empty .s so `go build` does not use -complete for go:linkname to work"
)
err
=
writeFile
(
filepath
.
Join
(
pkgdir
,
"trace.s"
),
buf
.
Bytes
())
trace_s
:=
filepath
.
Join
(
pkgdir
,
"trace.s"
)
err
=
writeFile
(
trace_s
,
buf
.
Bytes
())
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
// trace.s is needed only if there are trace imports
// (but still we do want to verify ^^^ we can write to it)
if
len
(
pkg
.
Importv
)
==
0
{
err
=
os
.
Remove
(
trace_s
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
}
return
nil
// XXX
return
nil
// XXX
}
}
...
...
go/xcommon/xnet/pipenet/trace.go
0 → 100644
View file @
0e2c9a36
// Code generated by lab.nexedi.com/kirr/go123/tracing/cmd/gotrace; DO NOT EDIT.
package
pipenet
// code generated for tracepoints
import
(
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
"unsafe"
)
// traceevent: traceAccept(conn net.Conn) XXX better raw .Text (e.g. comments)
type
_t_traceAccept
struct
{
tracing
.
Probe
probefunc
func
(
conn
net
.
Conn
)
}
var
_traceAccept
*
_t_traceAccept
func
traceAccept
(
conn
net
.
Conn
)
{
if
_traceAccept
!=
nil
{
_traceAccept_run
(
conn
)
}
}
func
_traceAccept_run
(
conn
net
.
Conn
)
{
for
p
:=
_traceAccept
;
p
!=
nil
;
p
=
(
*
_t_traceAccept
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
p
.
probefunc
(
conn
)
}
}
func
traceAccept_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
conn
net
.
Conn
))
*
tracing
.
Probe
{
p
:=
_t_traceAccept
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceAccept
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
// traceevent: traceDial(addr string) XXX better raw .Text (e.g. comments)
type
_t_traceDial
struct
{
tracing
.
Probe
probefunc
func
(
addr
string
)
}
var
_traceDial
*
_t_traceDial
func
traceDial
(
addr
string
)
{
if
_traceDial
!=
nil
{
_traceDial_run
(
addr
)
}
}
func
_traceDial_run
(
addr
string
)
{
for
p
:=
_traceDial
;
p
!=
nil
;
p
=
(
*
_t_traceDial
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
p
.
probefunc
(
addr
)
}
}
func
traceDial_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
addr
string
))
*
tracing
.
Probe
{
p
:=
_t_traceDial
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceDial
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
// traceevent: traceListen(laddr string) XXX better raw .Text (e.g. comments)
type
_t_traceListen
struct
{
tracing
.
Probe
probefunc
func
(
laddr
string
)
}
var
_traceListen
*
_t_traceListen
func
traceListen
(
laddr
string
)
{
if
_traceListen
!=
nil
{
_traceListen_run
(
laddr
)
}
}
func
_traceListen_run
(
laddr
string
)
{
for
p
:=
_traceListen
;
p
!=
nil
;
p
=
(
*
_t_traceListen
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
p
.
probefunc
(
laddr
)
}
}
func
traceListen_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
laddr
string
))
*
tracing
.
Probe
{
p
:=
_t_traceListen
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceListen
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
// traceevent: traceNew(name string) XXX better raw .Text (e.g. comments)
type
_t_traceNew
struct
{
tracing
.
Probe
probefunc
func
(
name
string
)
}
var
_traceNew
*
_t_traceNew
func
traceNew
(
name
string
)
{
if
_traceNew
!=
nil
{
_traceNew_run
(
name
)
}
}
func
_traceNew_run
(
name
string
)
{
for
p
:=
_traceNew
;
p
!=
nil
;
p
=
(
*
_t_traceNew
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
p
.
probefunc
(
name
)
}
}
func
traceNew_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
name
string
))
*
tracing
.
Probe
{
p
:=
_t_traceNew
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceNew
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
// traceevent: traceNewHost(host *Host) XXX better raw .Text (e.g. comments)
type
_t_traceNewHost
struct
{
tracing
.
Probe
probefunc
func
(
host
*
Host
)
}
var
_traceNewHost
*
_t_traceNewHost
func
traceNewHost
(
host
*
Host
)
{
if
_traceNewHost
!=
nil
{
_traceNewHost_run
(
host
)
}
}
func
_traceNewHost_run
(
host
*
Host
)
{
for
p
:=
_traceNewHost
;
p
!=
nil
;
p
=
(
*
_t_traceNewHost
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
p
.
probefunc
(
host
)
}
}
func
traceNewHost_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
host
*
Host
))
*
tracing
.
Probe
{
p
:=
_t_traceNewHost
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceNewHost
)),
&
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