MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / Close

Method Close

internal/etw/source.go:301–334  ·  view source on GitHub ↗

Close shutdowns all tracing sessions orderly. Firstly, the buffers are flushed. Then, the trace is closed to signal the event callback to stop consuming more events. Finally, the trace is stopped along with all event consumers.

()

Source from the content-addressed store, hash-verified

299// signal the event callback to stop consuming more events.
300// Finally, the trace is stopped along with all event consumers.
301func (e *EventSource) Close() error {
302 if e.isClosed {
303 return nil
304 }
305
306 for _, consumer := range e.consumers {
307 if err := consumer.Close(); err != nil {
308 log.Warnf("couldn't close consumer: %v", err)
309 }
310 }
311
312 for _, trace := range e.traces {
313 if !trace.IsStarted() {
314 continue
315 }
316 if err := trace.Flush(); err != nil {
317 log.Warnf("couldn't flush trace session for [%s]: %v", trace.Name, err)
318 }
319 time.Sleep(time.Millisecond * 150)
320 if err := trace.Close(); err != nil {
321 log.Warnf("couldn't close trace session for [%s]: %v", trace.Name, err)
322 }
323 time.Sleep(time.Millisecond * 250)
324 if err := trace.Stop(); err != nil {
325 log.Warnf("couldn't stop trace session for [%s]: %v", trace.Name, err)
326 }
327 }
328
329 close(e.stop)
330
331 e.isClosed = true
332
333 return e.sequencer.Shutdown()
334}
335
336// Errors returns the channel where errors are published.
337func (e *EventSource) Errors() <-chan error {

Implementers 2

EventSourceinternal/etw/source.go
EventSourceControlinternal/bootstrap/source.go

Calls 5

IsStartedMethod · 0.80
FlushMethod · 0.80
CloseMethod · 0.65
ShutdownMethod · 0.65
StopMethod · 0.45