什么是 _dl_lookup_symbol_x ?- C++ 分析 [英] What is _dl_lookup_symbol_x ? - C++ Profiling

查看:77
本文介绍了什么是 _dl_lookup_symbol_x ?- C++ 分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 valgrind/callgrind 来分析我的服务器代码以进行一些优化.callgrind 向我报告的两个最常用的调用(使用 kcachegrind 查看)是 _dl_lookup_symbol_x 和 do_lookup_x.但是我不知道这些是什么,似乎找不到任何关于它们的文档.

I'm using valgrind/callgrind to profile my server code for some optimization. The two most used calls that callgrind is reporting to me (using kcachegrind to view) are _dl_lookup_symbol_x and do_lookup_x. However I have no idea what either of these are and can't seem to find any documentation about them.

谁能告诉我这两个函数在哪里使用以及它们是做什么的?

Could anyone please tell me where these two functions are used and what they do?

推荐答案

_dl_lookup_symbol_x 是 glibc C 运行时库中的一个内部函数.如果您浏览 glibc 的源代码,您会发现这个_dl_lookup_symbol_x 定义上方的注释:

_dl_lookup_symbol_x is an internal function inside the glibc C runtime library. If you browse the source for glibc, you'll find this comment above the _dl_lookup_symbol_x definition:

/* Search loaded objects' symbol tables for a definition of the symbol
   UNDEF_NAME, perhaps with a requested version for the symbol.

do_lookup_x 只是一个在 _dl_lookup_symbol_x 函数中调用的辅助函数.

do_lookup_x is merely a helper function called within the _dl_lookup_symbol_x function.

我不是 glibc 内部的专家,但据我所知,_dl_lookup_symbol_x 在您的程序加载的共享库中查找符号(例如函数).

I'm no expert on the internals of glibc, but from what I can gather, _dl_lookup_symbol_x looks for a symbol (such as a function) inside shared libraries loaded by your program.

我不知道为什么在您的分析中如此频繁地调用这些函数,但至少现在您对它们的作用有了一些线索.您的分析应该告诉您哪些函数负责如此频繁地调用 _dl_lookup_symbol_x.

I don't know why these functions are called so often in your profiling, but at least now you have some clue as to what they do. Your profiling should tell you what functions are responsible for calling _dl_lookup_symbol_x so often.

请注意,在程序首次启动时多次调用 _dl_lookup_symbol_x 是正常的,因为运行时会计算出具有给定名称的共享库函数的地址.如果您正在分析一个非常短暂的程序,那么您会发现大部分时间都花在了内部内务管理"功能上,而不是您自己的代码上,这并不奇怪.

Note that it would be normal for _dl_lookup_symbol_x to be called many times when the program first starts, as the runtime figures out the addresses of shared library functions with a given name. If you're profiling a very short-lived program, then it's not surprising that you'd see that most of the time is spent in internal "housekeeping" functions rather than your own code.

这篇关于什么是 _dl_lookup_symbol_x ?- C++ 分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆