I want to trace system calls against some specific code lines in an Android application and using strace or system call hooking, I can get list of system calls against an APK.
I was wondering if there is any function call or anything else for which we know already exact number of system calls so that I can put it before and after my interested lines of code?
The trouble with what your trying to do is that your one-step divorced from the underlying system by the Java VM. It can be doing all sorts of system-call related stuff under your feet which your app has no control of.
In non-android world the most often used system call is ”gettimeofday” as it is never cached by the library functions and reasonably easy to see happen. However as you note in you previous question this is a lot harder as the VM is making gettimoufday calls of it’s own accord (most likely for accounting purposes). Therefor you want to choose a android function that results in a system call but isn’t likely to be called normally by the VM. Some candidates looking through the API include:
Good luck.