Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Accuracy of application profiler: (16 Items)
   
Accuracy of application profiler  
I have built the executable for ARM cortex A8 NEON processor and profiling the code using the momentics ICE 6.4.1 and 
the target board.

1. Whether the profiling is accurate ?
2. Does the profiling also includes the context switching time while executing any process ?
3. How to get accurate time (i.e. only time taken taken to run each function excluding system overheads and context 
switching time etc) for any function ?
Re: Accuracy of application profiler  
> I have built the executable for ARM cortex A8 NEON processor and profiling the
>  code using the momentics ICE 6.4.1 and the target board.
> 
> 1. Whether the profiling is accurate ?
> 2. Does the profiling also includes the context switching time while executing
>  any process ?
> 3. How to get accurate time (i.e. only time taken taken to run each function 
> excluding system overheads and context switching time etc) for any function ?

from within Momentics build options there are two different types of profiling available.
-classical gnu gprof style profiling
-function instrumentation profiling
to get detailed information you have to use the "function insturmentation" option.

to be abale to do threaded accounting you have to work together with kernel tracing.
normal logging in shared mem file does not provide the information about scheduling.
in other words: if you have one instrumented thread, the numbers will not be accurate according to other threads 
runnings
t1: P1.T1(instr) -> foo() enter
t2: scheduler
t3: Px.Tx -> running for x time
t4: scheduler
t5: P1.T1(instr) -> foo() exit
accounting will give you t5 - t1 as execution time for foo() and you do not see the scheduling.

about accuracy: be aware of Heisenberg, using function insturmentation and kernel tarcing you'll get a high system 
impact so that you should only look at the % numbers (and there was some stuff with inlines not being inlined any more).


have you allready checked this:
http://www.qnx.com/developers/docs/6.4.1/ide_en/user_guide/profiler.html

HTH
/hp
Re: Accuracy of application profiler  
Can you please explain how exactly I will be able to use 'Function instrumentation profiling' and Kernel trace to come 
up with the profiling data ?
Re: Accuracy of application profiler  
you have to compile and link your binary using function instrumentation.
when you use IDE it is doing the job for you when you select the option "function profiling"

when you compile on your own you have to use -finstrument-functions -lprofilingS

when you run your binary on the target you have to tell it what to do by using env vars.
look at the link of the previous post, they are listed there

when you now start a kenrel trace session you will get additional data in  it, which is usable for application profiling
.
But remember for this type of profiling only look at % numbers
After you have the trace available in your IDE you can import it into AppProfiler via the file context menu. 

I know that article I mentioned in that link is quite long, but it is worth to read it.

/hp
Re: Accuracy of application profiler  
Did you read IDE user's guide? Help->Help Contents... pick IDE Users's Guide


On 11/08/10 07:57 AM, Girisha SG wrote:
> Can you please explain how exactly I will be able to use 'Function instrumentation profiling' and Kernel trace to come
 up with the profiling data ?
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post62603
>
Re: Accuracy of application profiler  
There are few profiling methods to consider depends on your systems, for 
simplicity we give users two choices:
sampling + call count instrumentation
or function instrumentation

If you do function instrumentation you have also two choice: system-wide 
and single app.

The answer depends on what method you using.

Sampling require long running up, it is statistical method. It will only 
count sample if process is running (i.e. if it is blocked it won't be 
counted). Limitation: cannot use on multi-core cpu unless all threads 
are bound to cpu 0

Function Instrumentation in single app mode - counts elapsed time (in 
6.4.1), i.e. no context switches considered, also it is not good for 
multiple threads app if all threads are active. Profiling overhead is 
removed from final data.

Function Instrumentation in system-wide mode, same as above if you using 
App Profiler tool, but you also can use System Profiler tool - where you 
see non-aggregated data,
including context switches, and you can see statistics data for threads 
states, and so on.
It is very precise but generates lots of data, so you cannot really 
profiler more than a minute in this mode.

If you give me more details on your scenario I can recommend one method 
over the other.

Girisha SG wrote:
> I have built the executable for ARM cortex A8 NEON processor and profiling the code using the momentics ICE 6.4.1 and 
the target board.
>
> 1. Whether the profiling is accurate ?
> 2. Does the profiling also includes the context switching time while executing any process ?
> 3. How to get accurate time (i.e. only time taken taken to run each function excluding system overheads and context 
switching time etc) for any function ?
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post61320
>
>   
Re: Accuracy of application profiler  
I will be running multithreaded algorithm on ARM cortex A8 processor.
I want to profile the algorithm function/instruction wise and I am expecting the result to be accurate (That excludes 
all the overheads and will give me only actual time that an instruction has taken to execute on the target) to decide 
which instruction/functions are taking more time and needs optimization. 
Re: Accuracy of application profiler  
You explanation did not help much...
Is your processor multi-core?
Is your algorithm running for a long time (30 sec+) or short time? Is it 
just one algorithm or it is a general profiling problem (such as 
optimizing startup)?
Does algorithm involve more than one thread?
Does it involve other processes in the system?

Girisha SG wrote:
> I will be running multithreaded algorithm on ARM cortex A8 processor.
> I want to profile the algorithm function/instruction wise and I am expecting the result to be accurate (That excludes 
all the overheads and will give me only actual time that an instruction has taken to execute on the target) to decide 
which instruction/functions are taking more time and needs optimization. 
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post61524
>
>   
Re: Accuracy of application profiler  
My comments are inlined below with your questions
Is your processor multi-core?
    No, but it is of super scalar architecture.
    
Is your algorithm running for a long time (30 sec+) or short time?
    Final(i.e. after optimization) Algorithm will be running continuously in the system but to find out the places where
 I need to do the optimization I can profile it for 10 mins or so and based on that I can optimize the code.

Is it just one algorithm or it is a general profiling problem (such as optimizing startup)?
    I could not get it properly ...
    
Does algorithm involve more than one thread?
    Yes

Does it involve other processes in the system?
    It will involve other processes run by the OS and hence it will have context switching.
Re: Accuracy of application profiler  
If you can make it run contentiously I would suggest to run Sampling 
method. Run it for 10 min with Sampling (no re-compilation is required, 
just debug (-g))
and view results (switch to Table mode in the profiler). You will see 
which function run the most, and you will see how much each thread takes.
It is not exact numbers but is will be pretty accurate (the more you run 
the app the better the approximation). If you double click on function - 
you will see
annotated editor with per line sampling.

Girisha SG wrote:
> My comments are inlined below with your questions
> Is your processor multi-core?
>     No, but it is of super scalar architecture.
>     
> Is your algorithm running for a long time (30 sec+) or short time?
>     Final(i.e. after optimization) Algorithm will be running continuously in the system but to find out the places 
where I need to do the optimization I can profile it for 10 mins or so and based on that I can optimize the code.
>
> Is it just one algorithm or it is a general profiling problem (such as optimizing startup)?
>     I could not get it properly ...
>     
> Does algorithm involve more than one thread?
>     Yes
>
> Does it involve other processes in the system?
>     It will involve other processes run by the OS and hence it will have context switching.
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post61545
>
>   
Re: Accuracy of application profiler  
Thanks for the reply.

The application will be runing continuously but the algorithm will not be running continuously it will run for less than
 a second and hence I sampling method of profiling may not give the accurate result.
Re: Accuracy of application profiler  
Can you make it run continuously just for profiling?
If not do function instrumentation.

Girisha SG wrote:
> Thanks for the reply.
>
> The application will be runing continuously but the algorithm will not be running continuously it will run for less 
than a second and hence I sampling method of profiling may not give the accurate result.
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post61550
>
>   
Re: Accuracy of application profiler  
I might have to use function instrumentation method of profiling as I will not be able to run the algo continuously.

How accurate the function instrumentation method of profiling ?
Does it include context switching and other overheads and how to get the accurate result using this method by running 
the algorithm on the target board ?
Re: Accuracy of application profiler  
It is accurate but it does not include context switches overhead. It 
shows elapsed cpu time. If you algorithm would run close to 100% CPU 
time it is usually
not important. To see exact details run it in system wide more - in this 
case you can see it in system profiler - you check exactly how much you 
process
spent running vs blocked.

Girisha SG wrote:
> I might have to use function instrumentation method of profiling as I will not be able to run the algo continuously.
>
> How accurate the function instrumentation method of profiling ?
> Does it include context switching and other overheads and how to get the accurate result using this method by running 
the algorithm on the target board ?
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post61553
>
>   
Re: Accuracy of application profiler  
I am not interested in understanding context switch time.
I am interested in knowing exactly how much time is spent by each thread and function within each thread.
Re: Accuracy of application profiler  
Well use function instrumentation. If it does not help than we can 
continue talking.

Girisha SG wrote:
> I am not interested in understanding context switch time.
> I am interested in knowing exactly how much time is spent by each thread and function within each thread.
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post61557
>
>