简体   繁体   中英

What is runtime.kevent in a golang program's profile?

I am profiling a program where the vast majority (86%) of time is spent in two runtime functions: kevent and selectgo. I understand the select, but I don't know what kevent is (so I don't know where to start optimizing):

Showing top 10 nodes out of 33
      flat  flat%   sum%        cum   cum%
   114.63s 65.79% 65.79%    114.63s 65.79%  runtime.kevent /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s
    19.26s 11.05% 76.85%     35.90s 20.60%  runtime.selectgo /usr/local/Cellar/go/1.9.2/libexec/src/runtime/select.go

It's the network poller . There are multiple implementations:

You're seeing kevent due to being on Darwin. Basically, this is time spent waiting for I/O.

Note that it's called netpoll, but it applies to file descriptors in general, so it may be network communication but it could just as well be file I/O.

Here are more details about kqueue and epoll .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM