mirror of
https://github.com/libp2p/go-libp2p-resource-manager.git
synced 2025-03-10 17:20:39 +08:00
skip events that don't change anything in tracer (#38)
This happens when empty sub-scopes are moved around between scopes.
This commit is contained in:
parent
43054380a8
commit
5874c5f23a
36
trace.go
36
trace.go
@ -232,6 +232,10 @@ func (t *trace) ReserveMemory(scope string, prio uint8, size, mem int64) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if size == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceReserveMemoryEvt,
|
Type: traceReserveMemoryEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -246,6 +250,10 @@ func (t *trace) BlockReserveMemory(scope string, prio uint8, size, mem int64) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if size == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceBlockReserveMemoryEvt,
|
Type: traceBlockReserveMemoryEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -260,6 +268,10 @@ func (t *trace) ReleaseMemory(scope string, size, mem int64) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if size == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceReleaseMemoryEvt,
|
Type: traceReleaseMemoryEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -339,6 +351,10 @@ func (t *trace) AddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstreams
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deltaIn == 0 && deltaOut == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceAddStreamEvt,
|
Type: traceAddStreamEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -354,6 +370,10 @@ func (t *trace) BlockAddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nst
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deltaIn == 0 && deltaOut == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceBlockAddStreamEvt,
|
Type: traceBlockAddStreamEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -369,6 +389,10 @@ func (t *trace) RemoveStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstre
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deltaIn == 0 && deltaOut == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceRemoveStreamEvt,
|
Type: traceRemoveStreamEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -465,6 +489,10 @@ func (t *trace) AddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn, nco
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceAddConnEvt,
|
Type: traceAddConnEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -482,6 +510,10 @@ func (t *trace) BlockAddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceBlockAddConnEvt,
|
Type: traceBlockAddConnEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
@ -499,6 +531,10 @@ func (t *trace) RemoveConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
t.push(traceEvt{
|
t.push(traceEvt{
|
||||||
Type: traceRemoveConnEvt,
|
Type: traceRemoveConnEvt,
|
||||||
Scope: scope,
|
Scope: scope,
|
||||||
|
Loading…
Reference in New Issue
Block a user