What does native code look like in the DDMS profiler?

I know that the DDMS profiler does not profile native method calls, and I know I can use a variety of methods to profile native code, but what I really want to know is the proportion of native to Java code.

In particular, what does DDMS method profiling do when native methods are called? Does the time still get logged, or not? The app in question has a long, blocking native call, but it shows up as only taking 118ms, and as a long "underscore" in the visual trace viewer (as opposed to the solid "blocks" seen with Java code). Am I correct in guessing that time spent in native code is not added to a function's overall time in the profile?

Answers


The Dalvik method profiler records two time stamps for every method call. One comes from the CLOCK_THREAD_CPUTIME_ID timer, the other is just the wall clock time (gettimeofday()). The former is a rough measurement of the amount of time the thread has spent executing code.

The thread cputime clock doesn't advance when the thread is asleep (e.g. blocked on a mutex), but does advance while executing or (IIRC) waiting for disk I/O to complete. The original profiling code just recorded the thread cputime -- the wall clock time was added to the mix some time back so you could see how long the method actually took to execute as well as how busy it was.

For both managed and native code, an entry is created when the method is entered and when it returns. There's no real difference in that respect.


Need Your Help

How to add a VBA function to an Excel file in C#

c# excel excel-vba vba

My C# program creates an Excel file, I want this file to have a VBA function (so the user could change something without rerunning the program).

Git clone using ssh - can't find repository

git ssh msysgit

I'm trying to setup a Git server on Windows 7, using CopSsh, PuTTY and msysgit. I'm having problems cloning a repository using ssh.