Commit b5bfc158 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6b817f16
...@@ -354,18 +354,14 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f ...@@ -354,18 +354,14 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
X := exc.Raiseif X := exc.Raiseif
tracetest.Run(b, func(t0 *tracetest.T) { tracetest.Run(b, func(t0 *tracetest.T) {
println("AAA")
// create test cluster // create test cluster
zback := xfs1back("../zodb/storage/fs1/testdata/1.fs") zback := xfs1back("../zodb/storage/fs1/testdata/1.fs")
t := tNewCluster_MS(t0, "abc1", zback) t := tNewCluster_MS(t0, "abc1", zback)
defer t.Stop() defer t.Stop()
M := t.Master("m") M := t.Master("m")
println("BBB")
t.TraceOff() t.TraceOff()
println("CCC")
err := M.Start(); X(err) err := M.Start(); X(err)
println("DDD")
C := t.NewClient("c", "m:1") C := t.NewClient("c", "m:1")
......
...@@ -53,6 +53,7 @@ type tCluster struct { ...@@ -53,6 +53,7 @@ type tCluster struct {
name string // name of the cluster name string // name of the cluster
network *virtnet.SubNetwork // nodes interoperate via network network *virtnet.SubNetwork // nodes interoperate via network
traceOn bool // whether tracing is currently on or off
gotracer *TraceCollector // for tracing go nodes XXX -> GoTracer gotracer *TraceCollector // for tracing go nodes XXX -> GoTracer
//tpy *PyTracer // for tracing py nodes //tpy *PyTracer // for tracing py nodes
erouter *EventRouter // to which stream an event should go erouter *EventRouter // to which stream an event should go
...@@ -69,7 +70,7 @@ type tCluster struct { ...@@ -69,7 +70,7 @@ type tCluster struct {
// tNode represents information about a tested node. // tNode represents information about a tested node.
type tNode struct { type tNode struct {
itest interface{} // ITest{Master,Storage,Client} itest interface{} // ITest{Master,Storage,Client}
net xnet.Networker net *xnet.Tracer
} }
// ITestMaster represents tested master node. // ITestMaster represents tested master node.
...@@ -104,6 +105,7 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster { ...@@ -104,6 +105,7 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
t.network = pipenet.AsVirtNet(pipenet.New("testnet")) t.network = pipenet.AsVirtNet(pipenet.New("testnet"))
t.traceOn = true
t.erouter = NewEventRouter() t.erouter = NewEventRouter()
t.gotracer = NewTraceCollector(ttest) t.gotracer = NewTraceCollector(ttest)
ttest.SetEventRouter(t.erouter.RouteEvent) ttest.SetEventRouter(t.erouter.RouteEvent)
...@@ -140,8 +142,15 @@ func (t *tCluster) Stop() { ...@@ -140,8 +142,15 @@ func (t *tCluster) Stop() {
// TraceOff disables tracing. // TraceOff disables tracing.
// Trace events will stop to be created and delivered. // Trace events will stop to be created and delivered.
func (t *tCluster) TraceOff() { func (t *tCluster) TraceOff() {
t.traceOn = false
t.gotracer.Detach() t.gotracer.Detach()
//XXX t.pytracer.Detach() //XXX t.pytracer.Detach()
t.tabMu.Lock()
defer t.tabMu.Unlock()
for _, tnode := range t.nodeTab {
tnode.net.TraceOff()
}
} }
// Checker returns tracechecker corresponding to name. // Checker returns tracechecker corresponding to name.
...@@ -208,6 +217,9 @@ func (t *tCluster) registerNewNode(name string) *tNode { ...@@ -208,6 +217,9 @@ func (t *tCluster) registerNewNode(name string) *tNode {
node := &tNode{} node := &tNode{}
node.net = xnet.NetTrace(host, t.gotracer) node.net = xnet.NetTrace(host, t.gotracer)
if !t.traceOn {
node.net.TraceOff()
}
t.nodeTab[name] = node t.nodeTab[name] = node
return node return node
......
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