使用perf报告解释perf.data文件的输出

发布于 2025-02-11 01:36:17 字数 2563 浏览 2 评论 0原文

我的C ++应用程序正在消耗大量CPU周期。因此,我已经使用了Linux Profiler对我的应用程序进行了调查

。 。

# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 43K of event 'cpu-clock:uhH'
# Event count (approx.): 10966500000
#
# Overhead  Command          Shared Object              Symbol                                                                                                                                                                              
# ........  ...............  .........................  ....................................................................................................................................................................................
#

59.19%  ZManager  libc-2.23.so        [.] __mcount_internal
14.15%  ZManager  libc-2.23.so        [.] _mcount
 1.41%  ZManager  ZManager            [.] std::vector<unsigned int, std::allocator<unsigned int> >::~vector
 1.17%  ZManager  ZManager            [.] std::vector<unsigned int, std::allocator<unsigned int> >::size
 1.16%  ZManager  ZManager            [.] std::vector<unsigned int, std::allocator<unsigned int> >::vector
 0.46%  ZManager  ZManager            [.] std::_Vector_base<unsigned int, std::allocator<unsigned int> >::_Vector_impl::_Vector_impl
 0.45%  ZManager  ZManager            [.] std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned int const*, std::vector<unsigned int, std::allocator<unsigned int> > >, unsigned int*>
 0.40%  ZManager  libpthread-2.23.so         [.] pthread_mutex_lock
 0.39%  ZManager  ZManager            [.] std::__miter_base<__gnu_cxx::__normal_iterator<unsigned int const*, std::vector<unsigned int, std::allocator<unsigned int> > > >
 0.38%  ZManager  libc-2.23.so               [.] _int_malloc
 0.36%  ZManager  ZManager            [.] std::__niter_base<__gnu_cxx::__normal_iterator<unsigned int const*, std::vector<unsigned int, std::allocator<unsigned int> > > >
 0.34%  ZManager  ZManager            [.] std::allocator<unsigned int>::allocator
 0.34%  ZManager  ZManager            [.] std::allocator<unsigned int>::~allocator

从上面可以明显看出,大多数CPU是由LIBC中的某些指令所消耗的(我的程序正在调用),

这显示出

59.19%  ZManager  libc-2.23.so        [.] __mcount_internal
14.15%  ZManager  libc-2.23.so        [.] _mcount

显示什么__ mcount_internal_mcount方法?

My C++ application was consuming a lot of CPU cycles. So I have profiled my application using the Linux profiler.The output of the profiler (perf.data) file was generated, and I have run perf report

The report is given below.

# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 43K of event 'cpu-clock:uhH'
# Event count (approx.): 10966500000
#
# Overhead  Command          Shared Object              Symbol                                                                                                                                                                              
# ........  ...............  .........................  ....................................................................................................................................................................................
#

59.19%  ZManager  libc-2.23.so        [.] __mcount_internal
14.15%  ZManager  libc-2.23.so        [.] _mcount
 1.41%  ZManager  ZManager            [.] std::vector<unsigned int, std::allocator<unsigned int> >::~vector
 1.17%  ZManager  ZManager            [.] std::vector<unsigned int, std::allocator<unsigned int> >::size
 1.16%  ZManager  ZManager            [.] std::vector<unsigned int, std::allocator<unsigned int> >::vector
 0.46%  ZManager  ZManager            [.] std::_Vector_base<unsigned int, std::allocator<unsigned int> >::_Vector_impl::_Vector_impl
 0.45%  ZManager  ZManager            [.] std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned int const*, std::vector<unsigned int, std::allocator<unsigned int> > >, unsigned int*>
 0.40%  ZManager  libpthread-2.23.so         [.] pthread_mutex_lock
 0.39%  ZManager  ZManager            [.] std::__miter_base<__gnu_cxx::__normal_iterator<unsigned int const*, std::vector<unsigned int, std::allocator<unsigned int> > > >
 0.38%  ZManager  libc-2.23.so               [.] _int_malloc
 0.36%  ZManager  ZManager            [.] std::__niter_base<__gnu_cxx::__normal_iterator<unsigned int const*, std::vector<unsigned int, std::allocator<unsigned int> > > >
 0.34%  ZManager  ZManager            [.] std::allocator<unsigned int>::allocator
 0.34%  ZManager  ZManager            [.] std::allocator<unsigned int>::~allocator

From the above it is clear that majority of the CPU is consumed by some instruction in libc (which my program is calling)

It is shown as

59.19%  ZManager  libc-2.23.so        [.] __mcount_internal
14.15%  ZManager  libc-2.23.so        [.] _mcount

Does anyone know what __mcount_internal and _mcount means?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文