Skip to content

Commit

Permalink
skip events that don't change anything in tracer (#38)
Browse files Browse the repository at this point in the history
This happens when empty sub-scopes are moved around between scopes.
  • Loading branch information
marten-seemann authored Jun 4, 2022
1 parent 91b0b82 commit 2647b00
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions p2p/host/resource-manager/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ func (t *trace) ReserveMemory(scope string, prio uint8, size, mem int64) {
return
}

if size == 0 {
return
}

t.push(traceEvt{
Type: traceReserveMemoryEvt,
Scope: scope,
Expand All @@ -246,6 +250,10 @@ func (t *trace) BlockReserveMemory(scope string, prio uint8, size, mem int64) {
return
}

if size == 0 {
return
}

t.push(traceEvt{
Type: traceBlockReserveMemoryEvt,
Scope: scope,
Expand All @@ -260,6 +268,10 @@ func (t *trace) ReleaseMemory(scope string, size, mem int64) {
return
}

if size == 0 {
return
}

t.push(traceEvt{
Type: traceReleaseMemoryEvt,
Scope: scope,
Expand Down Expand Up @@ -339,6 +351,10 @@ func (t *trace) AddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstreams
return
}

if deltaIn == 0 && deltaOut == 0 {
return
}

t.push(traceEvt{
Type: traceAddStreamEvt,
Scope: scope,
Expand All @@ -354,6 +370,10 @@ func (t *trace) BlockAddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nst
return
}

if deltaIn == 0 && deltaOut == 0 {
return
}

t.push(traceEvt{
Type: traceBlockAddStreamEvt,
Scope: scope,
Expand All @@ -369,6 +389,10 @@ func (t *trace) RemoveStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstre
return
}

if deltaIn == 0 && deltaOut == 0 {
return
}

t.push(traceEvt{
Type: traceRemoveStreamEvt,
Scope: scope,
Expand Down Expand Up @@ -465,6 +489,10 @@ func (t *trace) AddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn, nco
return
}

if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
return
}

t.push(traceEvt{
Type: traceAddConnEvt,
Scope: scope,
Expand All @@ -482,6 +510,10 @@ func (t *trace) BlockAddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn
return
}

if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
return
}

t.push(traceEvt{
Type: traceBlockAddConnEvt,
Scope: scope,
Expand All @@ -499,6 +531,10 @@ func (t *trace) RemoveConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn,
return
}

if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
return
}

t.push(traceEvt{
Type: traceRemoveConnEvt,
Scope: scope,
Expand Down

0 comments on commit 2647b00

Please sign in to comment.