I am doing cpu-profiling using Android Studio3.5.1 using Android-Profiler using Sample Java Method option.When a non-optimised version of a method i use, method get listed in method trace pane. But when i try with optimised version of same method the method not getting listed in the pane.
Tried with two version of same method.
public int computeFibonacci(int positionInFibSequence) {
int prev = 0;
int current = 1;
int newValue;
for (int i=1; i<positionInFibSequence; i++) {
newValue = current + prev;
prev = current;
current = newValue;
}
return current;
/*if (positionInFibSequence <= 2) {
return 1;
} else {
return computeFibonacci(positionInFibSequence - 1)
+ computeFibonacci(positionInFibSequence - 2);
}*/
}
Found the answer.
Updating here because someone may have similar issue.
An inherent issue of sampled-based tracing is that if your app enters a method after a capture of the call stack and exits the method before the next capture, that method call is not logged by the profiler. If you are interested in tracing methods with such short lifecycles, you should use instrumented tracing.
Thanks.
Happy Coding.