Skip to content

Commit 2647b00

Browse files
skip events that don't change anything in tracer (#38)
This happens when empty sub-scopes are moved around between scopes.
1 parent 91b0b82 commit 2647b00

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

p2p/host/resource-manager/trace.go

+36
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ func (t *trace) ReserveMemory(scope string, prio uint8, size, mem int64) {
232232
return
233233
}
234234

235+
if size == 0 {
236+
return
237+
}
238+
235239
t.push(traceEvt{
236240
Type: traceReserveMemoryEvt,
237241
Scope: scope,
@@ -246,6 +250,10 @@ func (t *trace) BlockReserveMemory(scope string, prio uint8, size, mem int64) {
246250
return
247251
}
248252

253+
if size == 0 {
254+
return
255+
}
256+
249257
t.push(traceEvt{
250258
Type: traceBlockReserveMemoryEvt,
251259
Scope: scope,
@@ -260,6 +268,10 @@ func (t *trace) ReleaseMemory(scope string, size, mem int64) {
260268
return
261269
}
262270

271+
if size == 0 {
272+
return
273+
}
274+
263275
t.push(traceEvt{
264276
Type: traceReleaseMemoryEvt,
265277
Scope: scope,
@@ -339,6 +351,10 @@ func (t *trace) AddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstreams
339351
return
340352
}
341353

354+
if deltaIn == 0 && deltaOut == 0 {
355+
return
356+
}
357+
342358
t.push(traceEvt{
343359
Type: traceAddStreamEvt,
344360
Scope: scope,
@@ -354,6 +370,10 @@ func (t *trace) BlockAddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nst
354370
return
355371
}
356372

373+
if deltaIn == 0 && deltaOut == 0 {
374+
return
375+
}
376+
357377
t.push(traceEvt{
358378
Type: traceBlockAddStreamEvt,
359379
Scope: scope,
@@ -369,6 +389,10 @@ func (t *trace) RemoveStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstre
369389
return
370390
}
371391

392+
if deltaIn == 0 && deltaOut == 0 {
393+
return
394+
}
395+
372396
t.push(traceEvt{
373397
Type: traceRemoveStreamEvt,
374398
Scope: scope,
@@ -465,6 +489,10 @@ func (t *trace) AddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn, nco
465489
return
466490
}
467491

492+
if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
493+
return
494+
}
495+
468496
t.push(traceEvt{
469497
Type: traceAddConnEvt,
470498
Scope: scope,
@@ -482,6 +510,10 @@ func (t *trace) BlockAddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn
482510
return
483511
}
484512

513+
if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
514+
return
515+
}
516+
485517
t.push(traceEvt{
486518
Type: traceBlockAddConnEvt,
487519
Scope: scope,
@@ -499,6 +531,10 @@ func (t *trace) RemoveConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn,
499531
return
500532
}
501533

534+
if deltaIn == 0 && deltaOut == 0 && deltafd == 0 {
535+
return
536+
}
537+
502538
t.push(traceEvt{
503539
Type: traceRemoveConnEvt,
504540
Scope: scope,

0 commit comments

Comments
 (0)