Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4994 Discussions

vtune profiler not show the time inside the socket recv function in hotspots

loushuai
Beginner
897 Views

My software is a multi-thread database server for OLTP.

 

I run a benchmark for the database, and profiling the database server with vtune profiler.

The benchmark will simulate 72 connections to database server and each connection run a simple query to database concurrently. Each query is about 100-200 bytes.

 

The hotspots for database server :

 

loushuai_0-1668606417044.png

 

You will see recv function(linux socket standard recv function) cost too much time. so i want dig into recv to find the reason.

 

The source code can not go deeper.

loushuai_1-1668606553712.png

loushuai_2-1668606599716.png

 

The Caller/Callee can show some callees, but the CPU Time is negligible.

loushuai_3-1668606756839.png

 

How can go deeper to analyze why recv take so much time?

 

 

Labels (1)
0 Kudos
5 Replies
AlekhyaV_Intel
Moderator
859 Views

Hi,

 

Thank you for posting in Intel Communities. Based on the screenshots you provided, we could see that recv function is calling another function __recv_alias_(…) which is taking 202.7 seconds of the CPU time. To check the same, you need to see the call stacks pane in the Bottom-up window.

We took a small C++ sample where main function calls another function fib() from another program file(cpp_fib.cpp). Let me explain in detail as follows:

 

  • In the Summary Window of Vtune Profiler, I clicked on fib function, which is highlighted, from the below screenshot and got navigated to the Bottom-up window.

AlekhyaV_Intel_0-1668779743104.png

  • In the bottom-up window, if you double click on any function/call stack in the left sided pane, you could see the source code. We double clicked on fib to see fib.cpp program's source code as follows:

AlekhyaV_Intel_5-1668780101684.png

Note: The above screenshot only has 0.1% as it takes some negligible amount of time to print the result from fib(n) function. So, to see the Total CPU time that the fib(n) took, including calling and executing, you need to view source code from the Call stacks pane. See the detailed explanation with screenshots as follows.

 

  • In the bottom-up window, there’s a Call Stacks pane where you could hover over the .cpp files and you can view the source code of the functions you’ve called. The main() function in fib.cpp program is calling another function fib() which exists in cpp_fib.cpp program.

AlekhyaV_Intel_1-1668779775714.png

AlekhyaV_Intel_2-1668779869847.png

 

  • By clicking on view source from the pop as shown above, You would be navigated to the cpp_fib.cpp source code where you could see the CPU time as follows:

AlekhyaV_Intel_3-1668779899796.png

 

  • You could go back to the bottom-up pane to get any source code by hovering over each file in the Call Stacks Pane as follows:

AlekhyaV_Intel_4-1668779914065.png

 

Hope we are clear with all the details and result interpretations. If this resolves your issue, please accept this as a solution. This helps others with similar issue. Thank you!

 

Regards,

Alekhya

 

0 Kudos
loushuai
Beginner
840 Views

loushuai_0-1668829578178.png

 

loushuai_1-1668829623580.png

 

I can just go to the recv function in socket2.h source file which belongs to the system socket API ,

but I can not go inside__recv_alias_(…) function

0 Kudos
AlekhyaV_Intel
Moderator
797 Views

Hi,


You would be able to find that recv_alias_..(...) function in the source code where it actually exists. socket2.h file has recv_alias..() function initialized?

Or could you please share your sample code file so that we can try reproducing your issue?


Regards,

Alekhya


0 Kudos
AlekhyaV_Intel
Moderator
773 Views

Hi,


Could you please give us an update regarding this issue?


Regards,

Alekhya


0 Kudos
AlekhyaV_Intel
Moderator
748 Views

Hi,


We assume that your issue is resolved. If you need any further assistance, please post a new question as this thread will no longer be monitored by Intel.


Regards,

Alekhya


0 Kudos
Reply