Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Problem faced while trying to profile a sample application.: (2 Items)
   
Problem faced while trying to profile a sample application.  
Hi,

I'm trying to do some basic application profiling. Here is my sample application that I'd like to profile:

============== Sample.c ===================

void A()
{
	i++;
	j--;
}

void B()
{
	i--;
	j++;
}

int main(int argc, char *argv[]) {
	
	for(;;) {
		A();
		B();
	}
	
	return EXIT_SUCCESS;		
}
============================================

The program runs until I terminate it manually by sending SIGTERM. I've built the program with profiling information & 
have deselected "strib debug data from application while downloading". Now, in my profiling data, I'd like to see a 
function level view of this program - which clearly entails how much time is the code spending in each of the functions 
- A, B, main. BUt here is the putput I get from sampling (attached as .gif files).

1) As you can see in the sampling info, there are plenty of more addresses shown where the program is spending it time. 
I think it is showing profilinf info at the machine instruction level. I want it to only show a "function level" view. 
Is it possible?

2) I do not see "main" function any where in the sampling info?

3) I can't see any of my functions (main / A / B) in the call information / call graph etc? 

4) Lastly, trying to double click on function A() in the sampling info results in this error:

"Unable to create this part due to an internal error. Reason for the failure: Text editor does not have a document 
provider".

I'd appreciate if some one could help me out with this?

Also, once this is done, I'm looking forward to debugging a SHARED LIBRARY rather than an application. Any references / 
tutorials / links / pointers for that will be greatly appreciated.

Thanks,

Rajat
Attachment: Compressed file sampling.zip 113.44 KB
Re: Problem faced while trying to profile a sample application.  
>1) As you can see in the sampling info, there are plenty of more addresses shown where the program is spending it time.
 
I think it is showing profilinf info at the machine instruction level. I want it to only show a "function level" view. 
Is it possible?

I am not sure what version you are using, in official one 4.0.1 you should
see 3 groups Sample libc.so.2 and Uknown. If you click on Sample (your code) you should only see 3 functions A B and 
main (that is what I am seeing when I run your example). It may also depend on version of qconn you are using and 
version of OS on target side (also you results look very wrong - can it be binary mismatch between binary/library on 
target and host site?)


>2) I do not see "main" function any where in the sampling info?
That is another suspicious thing. Eather a) you not run it long enough to get any samples from it b) because of binary 
mismatches it cannot properly locate symbols


>3) I can't see any of my functions (main / A / B) in the call information / call graph etc? 
This again can be because addresses do not match with symbols on host site. What platform you run you code on (target)? 
But I really don't understand how it can be done if you using launch confguration that downloads binary on target itself
..

>4) Lastly, trying to double click on function A() in the sampling info results in this error:
If you using 2.95 compler you can try to compile it with -gdwarf-2 instead of -g; it changes debug format to a little 
bit better one


>Also, once this is done, I'm looking forward to debugging a SHARED LIBRARY rather than an application. Any references /
 
tutorials / links / pointers for that will be greatly appreciated.

If you know how to compile and run app with shared library the only extra trick is to add shared library path into 
Application profiler configuration in Tools tab of launch dialog.