Note that there are some explanatory texts on larger screens.

plurals
  1. POTraceview shows some methods arent being called for 200ms or more
    text
    copied!<p>Traceview shows that updatePhysics() is being called every 10ms or so and it takes about 8ms to run. The methods that I call inside updatePhysics are only running once every 5 or 6 times updatePhysics() runs, however. Is this simply a bug of Traceview, or what is going on? My game is stuttering a fair amount, so I am trying to figure out what is causing it.</p> <p>Traceview is generally showing that a lot of my methods go several hundred milliseconds without being called once, even though there appears to be no reason they shouldnt be called. Ideas?</p> <p>Run Method:</p> <pre><code> while (mRun) { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); Canvas c = null; try { c = mSurfaceHolder.lockCanvas(null);//null { time2 = System.nanoTime()/100000; // Get current time float delta = (time2 - time1)/1000f; if (mMode == STATE_RUNNING) updatePhysics(delta); else updateMenus(); doDraw(c); time1 = time2; } } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { mSurfaceHolder.unlockCanvasAndPost(c); } } } </code></pre> <p>Update Physics:</p> <pre><code> private void updatePhysics(float delta) { updateScore(delta); updateDifficulty(); } </code></pre> <p>EDIT: As you can see here, updateDifficulty is often not called for several hundred ms EVEN THOUGH updatePhysics is being called regularly... It makes no sense. <a href="http://i.stack.imgur.com/BU6Fv.png" rel="nofollow">Screenshot of traceview</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload