1

我使用 CGO 完成了一个 TCP 服务器。现在我想做一些基准分析和优化。

Go 和 C 之间的连接流程如下:

user <--> connFD <--> socketpair[0] <--> socketpair[1] <--> intranet server
|---------- Go domain ----------------|-------------- C domain -----------|

并且服务器只能在 docker 容器中运行。

我尝试使用 pprof 分析与真实用户 I/O 的几秒钟连接,但它什么也没给我:

(pprof) tree
Showing nodes accounting for 0, 0% of 0 total
----------------------------------------------------------+-------------
      flat  flat%   sum%        cum   cum%   calls calls% + context

(pprof) top
Showing nodes accounting for 0, 0% of 0 total
      flat  flat%   sum%        cum   cum%

因此我想知道 pprof 是否只能分析纯 Go 程序?我怎样才能正确地对这样的程序进行基准测试?

4

0 回答 0