Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

export the TraceEvt #40

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
traceRemoveConnEvt = "remove_conn"
)

type traceEvt struct {
type TraceEvt struct {
Time string
Type string

Expand All @@ -71,7 +71,7 @@ type traceEvt struct {
FD int `json:",omitempty"`
}

func (t *trace) push(evt traceEvt) {
func (t *trace) push(evt TraceEvt) {
t.mx.Lock()
defer t.mx.Unlock()

Expand Down Expand Up @@ -176,7 +176,7 @@ func (t *trace) Start(limits Limiter) error {

go t.background(out)

t.push(traceEvt{
t.push(TraceEvt{
Type: traceStartEvt,
Limit: limits,
})
Expand Down Expand Up @@ -209,7 +209,7 @@ func (t *trace) CreateScope(scope string, limit Limit) {
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceCreateScopeEvt,
Scope: scope,
Limit: limit,
Expand All @@ -221,7 +221,7 @@ func (t *trace) DestroyScope(scope string) {
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceDestroyScopeEvt,
Scope: scope,
})
Expand All @@ -236,7 +236,7 @@ func (t *trace) ReserveMemory(scope string, prio uint8, size, mem int64) {
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceReserveMemoryEvt,
Scope: scope,
Priority: prio,
Expand All @@ -254,7 +254,7 @@ func (t *trace) BlockReserveMemory(scope string, prio uint8, size, mem int64) {
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceBlockReserveMemoryEvt,
Scope: scope,
Priority: prio,
Expand All @@ -272,7 +272,7 @@ func (t *trace) ReleaseMemory(scope string, size, mem int64) {
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceReleaseMemoryEvt,
Scope: scope,
Delta: size,
Expand All @@ -292,7 +292,7 @@ func (t *trace) AddStream(scope string, dir network.Direction, nstreamsIn, nstre
deltaOut = 1
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceAddStreamEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -314,7 +314,7 @@ func (t *trace) BlockAddStream(scope string, dir network.Direction, nstreamsIn,
deltaOut = 1
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceBlockAddStreamEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -336,7 +336,7 @@ func (t *trace) RemoveStream(scope string, dir network.Direction, nstreamsIn, ns
deltaOut = -1
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceRemoveStreamEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -355,7 +355,7 @@ func (t *trace) AddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstreams
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceAddStreamEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -374,7 +374,7 @@ func (t *trace) BlockAddStreams(scope string, deltaIn, deltaOut, nstreamsIn, nst
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceBlockAddStreamEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -393,7 +393,7 @@ func (t *trace) RemoveStreams(scope string, deltaIn, deltaOut, nstreamsIn, nstre
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceRemoveStreamEvt,
Scope: scope,
DeltaIn: -deltaIn,
Expand All @@ -418,7 +418,7 @@ func (t *trace) AddConn(scope string, dir network.Direction, usefd bool, nconnsI
deltafd = 1
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceAddConnEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -445,7 +445,7 @@ func (t *trace) BlockAddConn(scope string, dir network.Direction, usefd bool, nc
deltafd = 1
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceBlockAddConnEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -472,7 +472,7 @@ func (t *trace) RemoveConn(scope string, dir network.Direction, usefd bool, ncon
deltafd = -1
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceRemoveConnEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -493,7 +493,7 @@ func (t *trace) AddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn, nco
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceAddConnEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -514,7 +514,7 @@ func (t *trace) BlockAddConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceBlockAddConnEvt,
Scope: scope,
DeltaIn: deltaIn,
Expand All @@ -535,7 +535,7 @@ func (t *trace) RemoveConns(scope string, deltaIn, deltaOut, deltafd, nconnsIn,
return
}

t.push(traceEvt{
t.push(TraceEvt{
Type: traceRemoveConnEvt,
Scope: scope,
DeltaIn: -deltaIn,
Expand Down