如何监控 channel 的缓冲区使用状况?

2020 年 7 月 15 日
 gantleman
例如当前创建了多少 channel 和缓冲区阻塞的长度。
2444 次点击
所在节点    Go 编程语言
5 条回复
guonaihong
2020 年 7 月 15 日
len(ch) channel 当前存储数据的长度
cap(ch) channel 的实际长度
gantleman
2020 年 7 月 15 日
@guonaihong 有没有非侵入的方法?
guonaihong
2020 年 7 月 15 日
@gantleman 没懂非侵入,可否举个例子。
gantleman
2020 年 7 月 15 日
@guonaihong 系统日志或监控系统的方法,与代码无关的。
janxin
2020 年 7 月 15 日
没有

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.ih06.com/t/690197

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX