1

I'm using gperftools to proflie my program and try to optimize it. After running my program with gperftools, I got this:

Total: 2902 samples
2765  95.3%  95.3%     2765  95.3% 0xb76e7cb0
  93   3.2%  98.5%       93   3.2% 0xb76e7cb1
  10   0.3%  98.8%     2643  91.1% CTestSession::SendMsg
   7   0.2%  99.1%        7   0.2% __pthread_enable_asynccancel
   6   0.2%  99.3%     2650  91.3% CTestSessionFactory::BroadCast
   6   0.2%  99.5%        6   0.2% __pthread_disable_asynccancel
   2   0.1%  99.6%        2   0.1% __gthread_active_p
   1   0.0%  99.6%        1   0.0% 0xb76e7ca5
   1   0.0%  99.6%        8   0.3% CMutexLock::UnLock
   1   0.0%  99.7%        6   0.2% CSDConnectionLinux::DoRecv
   1   0.0%  99.7%        1   0.0% CSDConnectionLinux::Send
   1   0.0%  99.7%     2651  91.4% CTestSession::OnRecv
   1   0.0%  99.8%        1   0.0% __GI___libc_malloc
   1   0.0%  99.8%        1   0.0% __GI___pthread_mutex_lock
   1   0.0%  99.8%        1   0.0% __libc_send
   1   0.0%  99.9%        1   0.0% __memcpy_ssse3_rep
   1   0.0%  99.9%        1   0.0% _int_free
   1   0.0%  99.9%     2662  91.7% main
   1   0.0% 100.0%        1   0.0% std::deque::_M_pop_front_aux
   1   0.0% 100.0%        1   0.0% std::vector::operator[]
   0   0.0% 100.0%        1   0.0% 0x14ac9604
   0   0.0% 100.0%        1   0.0% 0x14ac960b
   0   0.0% 100.0%        1   0.0% 0x14ac9610
   0   0.0% 100.0%        1   0.0% 0x14ac9617
   0   0.0% 100.0%        2   0.1% 0x14ac961a
   0   0.0% 100.0%        2   0.1% CBufManager::GetFreeBuf
   0   0.0% 100.0%        2   0.1% CBufManager::GiveBackBuf
   0   0.0% 100.0%        3   0.1% CEpoll::DoAccept
   0   0.0% 100.0%       35   1.2% CEpoll::DoRecv
   0   0.0% 100.0%       38   1.3% CEpoll::worker_thread
   0   0.0% 100.0%        4   0.1% CMutexLock::Lock
   0   0.0% 100.0%        5   0.2% CSDConnectionLinux::ParsePackets
   0   0.0% 100.0%        3   0.1% CSDListenerLinux::Accept
   0   0.0% 100.0%        1   0.0% CSDNet::AddEventOnRecv
   0   0.0% 100.0%     2661  91.7% CSDNet::Run
   0   0.0% 100.0%     2653  91.4% CSDQueueEventOnRecv::Work
   0   0.0% 100.0%        4   0.1% ISDConnectionCommon::ParsePacket
   0   0.0% 100.0%       40   1.4% __clone
   0   0.0% 100.0%        2   0.1% __gthread_mutex_lock
   0   0.0% 100.0%     2828  97.5% __libc_start_main
   0   0.0% 100.0%        1   0.0% _init
   0   0.0% 100.0%       40   1.4% start_thread
   0   0.0% 100.0%        1   0.0% std::deque::pop_front
   0   0.0% 100.0%        4   0.1% std::mutex::lock
   0   0.0% 100.0%        7   0.2% std::mutex::unlock
   0   0.0% 100.0%        1   0.0% std::queue::pop

I'm curious about what does "0xb76e7cb0" in the first line mean? Isn't a function? And why gperftools use that address? The program is a server actually, and in "SendMsg" the only thing it does is to call send function(through socket).

Li.Cao
  • 59
  • 5
  • It's because the profiler does not know the name of the function. It can only know the name of the function if the library has debug information. If you want to know what's really going on in a program, try [*this method*](http://stackoverflow.com/a/378024/23771). – Mike Dunlavey Mar 17 '17 at 12:33

0 Answers0