Commit 8d3aec5b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7ea73f36
// 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 neo package neo
// code generated for tracepoints
import ( import (
"lab.nexedi.com/kirr/neo/go/xcommon/tracing" "lab.nexedi.com/kirr/neo/go/xcommon/tracing"
"unsafe"
"lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
"net"
) )
// 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)
...@@ -21,7 +26,7 @@ func traceConnRecv(c *Conn, msg Msg) { ...@@ -21,7 +26,7 @@ func traceConnRecv(c *Conn, msg Msg) {
} }
} }
func _traceConnRecv_run(c, msg) { func _traceConnRecv_run(c *Conn, msg Msg) {
for p := _traceConnRecv; p != nil; p = (*_t_traceConnRecv)(unsafe.Pointer(p.Next())) { for p := _traceConnRecv; p != nil; p = (*_t_traceConnRecv)(unsafe.Pointer(p.Next())) {
p.probefunc(c, msg) p.probefunc(c, msg)
} }
...@@ -29,7 +34,7 @@ func _traceConnRecv_run(c, msg) { ...@@ -29,7 +34,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
} }
...@@ -48,7 +53,7 @@ func traceConnSend(c *Conn, msg Msg) { ...@@ -48,7 +53,7 @@ func traceConnSend(c *Conn, msg Msg) {
} }
} }
func _traceConnSend_run(c, msg) { func _traceConnSend_run(c *Conn, msg Msg) {
for p := _traceConnSend; p != nil; p = (*_t_traceConnSend)(unsafe.Pointer(p.Next())) { for p := _traceConnSend; p != nil; p = (*_t_traceConnSend)(unsafe.Pointer(p.Next())) {
p.probefunc(c, msg) p.probefunc(c, msg)
} }
...@@ -56,7 +61,7 @@ func _traceConnSend_run(c, msg) { ...@@ -56,7 +61,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
} }
......
...@@ -127,6 +127,8 @@ func parseTraceEvent(prog *loader.Program, pkgi *loader.PackageInfo, srcfile *as ...@@ -127,6 +127,8 @@ func parseTraceEvent(prog *loader.Program, pkgi *loader.PackageInfo, srcfile *as
// 1. all imports from original source file // 1. all imports from original source file
// 2. dot-import of original package // 2. dot-import of original package
// so that inside it all looks like as if it was in original source context // so that inside it all looks like as if it was in original source context
//
// FIXME this does not work when a tracepoint uses unexported type
buf.emit("\nimport (") buf.emit("\nimport (")
for _, imp := range srcfile.Imports { for _, imp := range srcfile.Imports {
...@@ -195,7 +197,7 @@ func parseTraceEvent(prog *loader.Program, pkgi *loader.PackageInfo, srcfile *as ...@@ -195,7 +197,7 @@ func parseTraceEvent(prog *loader.Program, pkgi *loader.PackageInfo, srcfile *as
} }
// packageTrace returns tracing information about a package // packageTrace returns tracing information about a package
func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package { func packageTrace(prog *loader.Program, pkgi *loader.PackageInfo) *Package {
eventv := []*traceEvent{} eventv := []*traceEvent{}
importv := []*traceImport{} importv := []*traceImport{}
...@@ -203,7 +205,7 @@ func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package { ...@@ -203,7 +205,7 @@ func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package {
for _, file := range pkgi.Files { // ast.File for _, file := range pkgi.Files { // ast.File
for _, commgroup := range file.Comments { // ast.CommentGroup for _, commgroup := range file.Comments { // ast.CommentGroup
for _, comment := range commgroup.List { // ast.Comment for _, comment := range commgroup.List { // ast.Comment
pos := lprog.Fset.Position(comment.Slash) pos := prog.Fset.Position(comment.Slash)
//fmt.Printf("%v %q\n", pos, comment.Text) //fmt.Printf("%v %q\n", pos, comment.Text)
// only directives starting from beginning of line // only directives starting from beginning of line
...@@ -223,7 +225,7 @@ func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package { ...@@ -223,7 +225,7 @@ func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package {
directive, arg := textv[0], textv[1] directive, arg := textv[0], textv[1]
switch directive { switch directive {
case "//trace:event": case "//trace:event":
event, err := parseTraceEvent(lprog, pkgi, file, pos, arg) event, err := parseTraceEvent(prog, pkgi, file, pos, arg)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
...@@ -255,13 +257,17 @@ func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package { ...@@ -255,13 +257,17 @@ func packageTrace(lprog *loader.Program, pkgi *loader.PackageInfo) *Package {
// ---------------------------------------- // ----------------------------------------
// TypedArgv returns argument list with types // TypedArgv returns argument list with types qualified relative to original package
func (te *traceEvent) TypedArgv() string { func (te *traceEvent) TypedArgv() string {
return TypedArgvRelativeTo(te.Pkgi.Pkg)
}
func (te *traceEvent) TypedArgvRelativeTo(pkg *types.Package) string {
//format.Node(&buf, fset, te.FuncDecl.Type.Params) //format.Node(&buf, fset, te.FuncDecl.Type.Params)
argv := []string{} argv := []string{}
// qualifier // default qualifier - relative to original package
qf := func(pkg *types.Package) string { qf = func(pkg *types.Package) string {
// original package - unqualified // original package - unqualified
if pkg == te.Pkgi.Pkg { if pkg == te.Pkgi.Pkg {
return "" return ""
...@@ -388,6 +394,7 @@ func checkCanWrite(path string) error { ...@@ -388,6 +394,7 @@ func checkCanWrite(path string) error {
} }
// writeFile writes data to a file at path after checking it is safe to write there // writeFile writes data to a file at path after checking it is safe to write there
// TODO check if content is the same and do not write then ? (XXX name -> updateFile ?)
func writeFile(path string, data []byte) error { func writeFile(path string, data []byte) error {
err := checkCanWrite(path) err := checkCanWrite(path)
if err != nil { if err != nil {
......
// 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"
"net"
)
// 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
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment