Hi,

I'm not sure whether I'm badly misusing InstructionCount or there is a
bug, but let's assume the first one for now...

The simplified situation is like that: I have a function (say, foo())
for which I want to track the number of instructions executed and the
function itself calls another function (say, bar()), for which I also
want to keep track of the number of instructions executed, something
like:

...
private void foo(){
    Debug.InstructionCount icount = new Debug.InstructionCount();
    icount.resetAndStart();
    // Some code here
    bar();
    // Some more code
    if (icount.collect()){
        // Log the number of instructions, icount.globalTotal()
    }
}

private void bar(){
    Debug.InstructionCount icount = new Debug.InstructionCount();
    icount.resetAndStart();
    // Some code here
    if (icount.collect()){
        // Log the number of instructions, icount.globalTotal()
    }
}

Well, you get the idea. So, in a slightly more complex case (some more
function calls, but nothing very complex), what happens is:

07-22 15:07:36.283: DEBUG/dalvikvm(10131): +++ active profiler count
now 0
07-22 15:07:45.222: DEBUG/dalvikvm(10131): +++ active profiler count
now 1
07-22 15:07:45.242: DEBUG/dalvikvm(10131): +++ active profiler count
now 2
07-22 15:07:45.292: DEBUG/dalvikvm(10131): +++ active profiler count
now 1
07-22 15:07:45.312: DEBUG/dalvikvm(10131): +++ active profiler count
now 2
07-22 15:07:47.052: DEBUG/dalvikvm(10131): +++ active profiler count
now 1
07-22 15:07:47.082: ERROR/dalvikvm(10131): ERROR: instruction counting
not enabled
07-22 15:07:47.082: ERROR/dalvikvm(10131): VM aborting
07-22 15:07:47.193: INFO/DEBUG(28): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
07-22 15:07:47.202: INFO/DEBUG(28): Build fingerprint: 'generic/sdk/
generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
07-22 15:07:47.202: INFO/DEBUG(28): pid: 10131, tid: 10131  >>>
de.tlabs.mobileCloud.client <<<
07-22 15:07:47.202: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr
deadd00d
...

I could understand that, e.g. only one counter could be running for a
thread or something, but the number of counters clearly goes up and
down for a while until DalvikVM exits.

Any ideas on what could be wrong and/or how I could keep track of
instruction count for each single method?

Thanks!

Andrius

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to