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

strange cpu usage

softarts
Beginner
365 Views

a sniffer program, usually 'top' shows cpu usage is about 6%

when I add the below trivial code, cpu usage jump to 86%!


vtune analysis result:(lightweight hotspot)

void dummyprocessPacket(char *packeT0
{

int i;

for (i=0;i<800;i++) cpu time:66.878s

{

int s = 86400+i; 38.765s
int j=s+2345; 122.333s

}

//other normal processing
}


the call stack is:
void packet_capture()
{
while (1)
{
if (packet_recv(fd)>0) //received
dummyprocesspacket();
}
}

bottom-up:

packet_capture ----0.389s
dummyProcessPacket----229.577s
memcpy ....0.141s

any idea to solve this problem,will the 'top'be not accurate?



0 Kudos
1 Reply
Peter_W_Intel
Employee
365 Views
What I can suggest is to do dummyProcessPacket() in other thread(s).
Are you working on multi-core system?
Regards, Peter
0 Kudos
Reply