Community
cancel
Showing results for 
Search instead for 
Did you mean: 
sid9559
Beginner
108 Views

default constructor as the hotspot

Hello ,

I am doing some hotspot analysis on Image quality assesment algorithms. I found that my one of the default consructor is a hotspot.

// default constructor

template

inline GBuffer::GBuffer(

size_type width,

size_type height

) : pData_(NULL), width_(width), height_(height),

tagX_(0), tagY_(0), sleeping_(false)

{

UpdateMemory(true);

}


when i click on the buttom up analysis and go to the source code. I am pointed to the

{

UpdateMemory(true);

}


I cannot understand what is wrong and why my constructor is a hotspot.

regards,
Siddharth

0 Kudos
9 Replies
Peter_W_Intel
Employee
108 Views

I suspect that your code created many objects by using this construct (class GBuffer?).So UpdateMemory() will be called frequently...it'swhyUpdateMemory() consumed high CPU time.

You canreview call stack to know where it happened.

Regards, Peter
sid9559
Beginner
108 Views

The call stack pane shows the it was called 20 times. I am not sure if 20 times is a big number.

Regards,
Siddharth
Peter_W_Intel
Employee
108 Views

Quoting sid9559
The call stack pane shows the it was called 20 times. I am not sure if 20 times is a big number.

Regards,
Siddharth

That is statistical call, not real call count.

sid9559
Beginner
108 Views

I did not get you. what does a statistical call mean??

regards,
Siddharth
Peter_W_Intel
Employee
108 Views

Statistical call graph means, the tool doesn'trecord all executions in function entry - uses sampling data collection to capture samples in function, and know callerfrom stack walk info. In this way, thetool finds all hot functions (source lines) with caller's info, but call count is not the REALfunction'sexecutionnumber.
sid9559
Beginner
108 Views

OK i get your point. Just to be sure, the tool takes samples at a predefined interval by interupting the execution and uses the instruction pointer to find out the function and the function which shows the maximum samples is a hotspot.

But still i do not understand how is the information from the call stack going to help me tune the program and remove my default constructor as a hotspot.

Also,from the call stack panei can see that my constructorhas been called say 'x' times. Could you please explain me the significance of this number.


Regards,
Siddharth
Peter_W_Intel
Employee
108 Views

You may consider if UpdateMemory() in constructor is necessary - review your algorithm, is it possile to remove UpdateMemory to member function, and call it when necessary...

If you keep UpdateMemory() in constructor, you may tune UpdateMemory() to reduce cycles, for example - predefined analysis "general exploration" to find issues in microarchitecture, i.e. cache misses, branch misprediction, etc.

Regards, Peter
sid9559
Beginner
108 Views

Alright, it makes sense. I will try that out and see what happens. Also, as i asked you previously, what is the significance of the number of calls shown in the call stack pane and how is that usefull. could you explain me breifly??

regards,
Siddharth
Peter_W_Intel
Employee
108 Views

You need to care of the caller with high percent - which is a critical path in call stack to hot function.
Reply