Skip to content

Commit

Permalink
Update get perf buffer and ring buffer instance
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Anh Duong <anh.duong@kyber.network>
  • Loading branch information
vietanhduong committed Dec 26, 2023
1 parent b27ed5f commit 8a07798
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ func (m *Module) ClosePerfBuffer(name string) {
m.perfbufs.Remove(name)
}

func (m *Module) GetPerfBuffer(name string) *PerfBuf {
buf, _ := m.perfbufs.Get(name)
return buf
}

func (m *Module) PollPerfBuffer(name string, timeout time.Duration) int {
if buf, _ := m.perfbufs.Get(name); buf != nil {
count, _ := buf.Poll(timeout)
Expand Down Expand Up @@ -389,6 +394,11 @@ func (m *Module) CloseRingBuffer(name string) {
m.ringbufs.Remove(name)
}

func (m *Module) GetRingBuffer(name string) *RingBuf {
buf, _ := m.ringbufs.Get(name)
return buf
}

func (m *Module) PollRingBuffer(name string, timeout time.Duration) int {
if buf, _ := m.ringbufs.Get(name); buf != nil {
count, _ := buf.Poll(timeout)
Expand Down

0 comments on commit 8a07798

Please sign in to comment.