Commit 0e2c9a36 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 36c08110
// Code generated by lab.nexedi.com/kirr/go123/tracing/cmd/gotrace; DO NOT EDIT.
package 0x5f45c0
package neo
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)
......@@ -29,7 +29,7 @@ func _traceConnRecv_run(c, msg) {
func traceConnRecv_Attach(pg *tracing.ProbeGroup, probe func(c *Conn, msg Msg)) *tracing.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
}
......@@ -56,7 +56,7 @@ func _traceConnSend_run(c, msg) {
func traceConnSend_Attach(pg *tracing.ProbeGroup, probe func(c *Conn, msg Msg)) *tracing.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
}
......
......@@ -240,7 +240,7 @@ func {{.Name}}({{.TypedArgv}}) {
}
{{/* function to notify attached probes */ -}}
func _{{.Name}}_run({{.Argv}}) {
func _{{.Name}}_run({{.TypedArgv}}) {
for p := _{{.Name}}; p != nil; p = (*_t_{{.Name}})(unsafe.Pointer(p.Next())) {
p.probefunc({{.Argv}})
}
......@@ -249,7 +249,7 @@ func _{{.Name}}_run({{.Argv}}) {
{{/* function to attach a probe to tracepoint */ -}}
func {{.Name}}_Attach(pg *tracing.ProbeGroup, probe func({{.TypedArgv}})) *tracing.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
}
`))
......@@ -315,6 +315,7 @@ func tracegen(pkgpath string) error {
conf.Import(pkgpath)
// load package + all its imports
// XXX ignore trace.go & trace.s on load here?
lprog, err := conf.Load()
if err != nil {
log.Fatal(err)
......@@ -339,9 +340,11 @@ func tracegen(pkgpath string) error {
// prologue
buf.WriteString(magic)
buf.emit("\npackage %v", pkg.Pkgi.Pkg.Name)
buf.emit("\npackage %v", pkg.Pkgi.Pkg.Name())
buf.emit("// code generated for tracepoints")
buf.emit("\nimport (")
buf.emit("\t\tlab.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
buf.emit(")")
......@@ -360,15 +363,15 @@ func tracegen(pkgpath string) error {
for _, timport := range pkg.Importv {
buf.emit("// traceimport: %v", timport.PkgPath)
pkgi = lprog.Package(timport.PkgPath)
if pkgi == nil {
impPkgi := lprog.Package(timport.PkgPath)
if impPkgi == nil {
// TODO do not require vvv
log.Fatalf("%v: package %s must be also regularly imported", timport.Pos, timport.PkgPath)
}
pkg = packageTrace(lprog, pkgi)
impPkg := packageTrace(lprog, impPkgi)
for _, event := range pkg.Eventv {
for _, event := range impPkg.Eventv {
err = traceEventImportTmpl.Execute(buf, event)
if err != nil {
panic(err) // XXX
......@@ -385,17 +388,26 @@ func tracegen(pkgpath string) error {
log.Fatal(err)
}
// XXX vvv needed only if there are trace imports
// write empty trace.s so go:linkname works
buf.Reset()
buf.WriteString(magic)
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 {
log.Fatal(err)
}
}
return nil // XXX
}
......
// 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
}
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