Android游戏中的零星滞后

时间:2014-07-29 14:05:16

标签: java android lag

我正在使用Java制作简单的Android游戏。我每20-40秒就注意到一些令人讨厌的滞后。首先,我认为它们是由垃圾收集器引起的,但是当我检查我的LogCat时,我发现在游戏滞后时没有垃圾收集。 每当游戏开始滞后时我就会记录日志,并且几乎每次都会看到这个日志条目:

  

W / qdhwcomposer(209):读取vsync的延迟时间过长:耗时47 ms

正如它所说,有一个延迟(通常> 45ms),我认为这是我注意到的延迟。 有人知道这个问题或如何避免这些延误吗?



这是游戏滞后时LogCat的两个片段:

07-29 15:11:50.196: D/BatteryService(692): update start
07-29 15:11:50.206: D/BatteryService(692): level:80, scale:100, status:2, health:2, present:true, voltage: 4121, temperature: 355, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303554, invalid charger:0, online:4, charge type:1, current avg:460
07-29 15:11:50.206: D/BatteryService(692): Sending ACTION_BATTERY_CHANGED.
07-29 15:11:50.216: D/STATUSBAR-BatteryController(1082): onReceive() - ACTION_BATTERY_CHANGED
07-29 15:11:50.216: D/STATUSBAR-BatteryController(1082): onReceive() - BATTERY_STATUS_CHARGING:
07-29 15:11:50.226: D/HeadsetStateMachine(18054): Disconnected process message: 10
07-29 15:11:50.236: W/qdhwcomposer(209): Excessive delay reading vsync: took 47 ms
07-29 15:11:50.236: D/STATUSBAR-IconMerger(1082): checkOverflow(288), More:true, Req:true Child:5

07-29 15:12:00.176: W/qdhwcomposer(209): Excessive delay reading vsync: took 49 ms
07-29 15:12:00.226: D/BatteryService(692): update start
07-29 15:12:00.226: D/BatteryService(692): level:80, scale:100, status:2, health:2, present:true, voltage: 4065, temperature: 355, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303554, invalid charger:0, online:4, charge type:1, current avg:460
07-29 15:12:00.226: D/BatteryService(692): Sending ACTION_BATTERY_CHANGED.
07-29 15:12:00.236: D/STATUSBAR-BatteryController(1082): onReceive() - ACTION_BATTERY_CHANGED
07-29 15:12:00.236: D/STATUSBAR-BatteryController(1082): onReceive() - BATTERY_STATUS_CHARGING:
07-29 15:12:00.236: D/HeadsetStateMachine(18054): Disconnected process message: 10



我在三星Galaxy S4(GT-I9505)btw上用Android 4.3测试了它。

感谢
杰鲁

1 个答案:

答案 0 :(得分:0)