perf 报告:为什么说我的函数正在调用 main?

问题描述 投票:0回答:1

这是

perf report
的摘录:

Samples: 47K of event 'cycles', Event count (approx.): 22843195013
  Children      Self       Command          Shared Object         Symbol
+   97.13%     0.01%       server           server             [.] Server::runEventLoopOnce                                             ◆
-   96.70%    52.84%       server           server             [.] Server::onRecvBlock                                                               ▒
   + 46.21% 0x7fd3fa4f9253                                                                                                                                                             ▒
   + 43.86% ServerQueue::onRecvBlock                                                                                                                                             ▒
   + 6.61% __libc_start_call_main                                                                                                                                                      ▒

我的函数

Server::onRecvBlock()
怎么可能调用
__libc_start_call_main

我正在使用

perf record --call-graph=fp ./server
进行捕捉。可执行文件是用
-fno-omit-frame-pointer
编译的。

perf
1个回答
0
投票

也许您的报告列出了被调用者的列表,这意味着列表中的所有项目都是调用您的函数的位置。那么 6.61% 的时间,

Server::onRecvBlock()
是直接从 main 调用的?

为了更确定实际打印的内容,您可以指定是否要在记录中列出被调用者或调用者函数:

列出调用您的函数的函数:

perf report --call-graph graph,0.001,callee,function,percent

列出调用顶行函数时花费时间最多的函数:

perf report --call-graph graph,0.001,caller,function,percent

查看报告帮助了解其他选项

perf report -h
© www.soinside.com 2019 - 2024. All rights reserved.