< p>我使用gperftools来查询我的程序并尝试对其进行优化。用gperftools运行我的程序后,我得到了这个:< / p>
< pre>< code>总计:2902个样本
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%主要
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 ::接受
0 0.0%100.0%1 0.0%CSDNet :: AddEventOnRecv
0 0.0%100.0%2661 91.7%CSDNet ::运行
0 0.0%100.0%2653 91.4%CSDQueueEventOnRecv ::工作
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
< /代码>< /预>
< p>我很好奇" 0xb76e7cb0"在第一行是什么意思?不是一个功能吗?为什么gperftools使用该地址?该程序实际上是一个服务器,并且在" SendMsg"它唯一能做的就是调用send函数(通过socket)。 < / p为H.