...

Source file src/runtime/netpoll_os_test.go

Documentation: runtime

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime_test
     6  
     7  import (
     8  	"runtime"
     9  	"sync"
    10  	"testing"
    11  )
    12  
    13  var wg sync.WaitGroup
    14  
    15  func init() {
    16  	runtime.NetpollGenericInit()
    17  }
    18  
    19  func BenchmarkNetpollBreak(b *testing.B) {
    20  	b.StartTimer()
    21  	for i := 0; i < b.N; i++ {
    22  		for j := 0; j < 10; j++ {
    23  			wg.Add(1)
    24  			go func() {
    25  				runtime.NetpollBreak()
    26  				wg.Done()
    27  			}()
    28  		}
    29  	}
    30  	wg.Wait()
    31  	b.StopTimer()
    32  }
    33  

View as plain text