Source file src/runtime/netpoll_os_test.go

     1  package runtime_test
     2  
     3  import (
     4  	"runtime"
     5  	"sync"
     6  	"testing"
     7  )
     8  
     9  var wg sync.WaitGroup
    10  
    11  func init() {
    12  	runtime.NetpollGenericInit()
    13  }
    14  
    15  func BenchmarkNetpollBreak(b *testing.B) {
    16  	b.StartTimer()
    17  	for i := 0; i < b.N; i++ {
    18  		for j := 0; j < 10; j++ {
    19  			wg.Add(1)
    20  			go func() {
    21  				runtime.NetpollBreak()
    22  				wg.Done()
    23  			}()
    24  		}
    25  	}
    26  	wg.Wait()
    27  	b.StopTimer()
    28  }
    29  

View as plain text