什么是函数__tcf_0? (使用gprof和g ++时看到) [英] What is function __tcf_0? (Seen when using gprof and g++)

查看:519
本文介绍了什么是函数__tcf_0? (使用gprof和g ++时看到)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用g ++ 4.2.4,我试图追踪我的代码中的一些性能问题。



我运行gprof生成配置文件,我得到以下陌生,最昂贵的函数是__tcf_0:

 每个样本计数为0.01秒。 
%累积自我总计
时间秒秒调用ms /调用ms /调用名
40.00 0.04 0.04 1 40.00 95.00 __tcf_0

这个函数似乎调用我的大多数用户函数(即它是从main调用的函数)。我找到的最近的解释是这里,但该链接指的是静态对象和atexit,我不认为这适用于我的情况。



如果有用,我使用Boost(program_options和fusion) HDF5库。



UPDATE:



  g ++ -Wreturn-type -Wunused -Winline -pg -DLINUX -DHAS_SETENV \ 
-DFUSION_MAX_MAP_SIZE = 15 - DFUSION_MAX_VECTOR_SIZE = 15 -g -O0 \
--param large-function-growth = 300 --param inline-unit-growth = 200


解决方案

__ tcf_0似乎确实是一个函数,它调用静态对象的析构函数,并为每个静态对象注册,取得理所当然的此页) / p>

现在,你的gprof的结果是相当奇怪,因为花费大部分时间的函数只需要0.04秒,这意味着整个程序需要0.1秒执行。如果我没有错,我的猜测是你没有正确配置文件。您是否已启用分析功能来编译代码?


We use g++ 4.2.4 and I'm trying to track down some performance problems in my code.

I'm running gprof to generate the profile, and I'm getting the following "strangeness" in that the most expensive function is __tcf_0:

Each sample counts as 0.01 seconds.
 %   cumulative   self              self     total           
time   seconds   seconds    calls  ms/call  ms/call  name    
40.00      0.04     0.04        1    40.00    95.00  __tcf_0

This function then appears to calls most of my user functions (ie. it is the one that's called from main). The nearest explanation that I found for this was here, but that link refers to static objects and atexit, and I don't think this applies in my case.

If it's helpful, I'm using Boost (program_options and fusion) and the HDF5 libraries.

UPDATE:

The command I use when building is:

g++  -Wreturn-type -Wunused -Winline -pg  -DLINUX -DHAS_SETENV \
    -DFUSION_MAX_MAP_SIZE=15 -DFUSION_MAX_VECTOR_SIZE=15  -g -O0 \
    --param large-function-growth=300 --param inline-unit-growth=200

解决方案

__tcf_0 seems indeed to be a function which calls destructor of static objects and which is registered for each static objects, to be called at exit (taking for granted what is said on this page)

Now, the result of your gprof is quite strange, since the function which takes most of the time only takes 0.04 seconds, which means the whole program takes 0.1 s to execute. If I'm not mistaken, my guess is that you didn't profile correctly. Did you compile your code with profiling enabled?

这篇关于什么是函数__tcf_0? (使用gprof和g ++时看到)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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