简体   繁体   English

Golang程序的配置文件中的runtime.kevent是什么?

[英]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. 我正在分析一个程序,其中大部分时间(86%)花费在两个运行时函数上:kevent和selectgo。 I understand the select, but I don't know what kevent is (so I don't know where to start optimizing): 我了解选择,但是我不知道什么是kevent(所以我不知道从哪里开始优化):

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. 您因为在达尔文(Darwin)上而看到了kevent Basically, this is time spent waiting for I/O. 基本上,这是等待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. 请注意,它称为netpoll,但通常适用于文件描述符,因此它可能是网络通信,但也可能是文件I / O。

Here are more details about kqueue and epoll . 以下是有关kqueueepoll的更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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