码迷,mamicode.com
首页 > 其他好文 > 详细

记录一下 小游戏模板里面遇到ANR

时间:2020-12-24 12:31:14      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:image   secret   阻塞   null   support   bec   mda   bind   state   

 

如图:打印日志

E/HsmCoreServiceImpl: onTransact in code is: 103
2020-12-19 22:23:29.078 629-13102/? E/uniperf server: uniPerfEvent doParse failed, cmdId=4400
2020-12-19 22:23:29.341 629-13102/? E/uniperf server: uniPerfEvent doParse failed, cmdId=4400
2020-12-19 22:23:29.561 30202-30202/com.rhkj.zhihuixue E/zhihuixue_:Pc04Dialog.next(Line:121): 第4题
2020-12-19 22:23:29.589 629-13102/? E/uniperf server: uniPerfEvent doParse failed, cmdId=4402
2020-12-19 22:23:29.602 3871-3886/? E/AppLifeChangeSensor:  CAWARENESS: activityPaused mAppLifeChangeCallback is null 
2020-12-19 22:23:29.705 1801-1825/? E/HsmCoreServiceImpl: onTransact in code is: 103
2020-12-19 22:23:29.795 1801-1825/? E/HsmCoreServiceImpl: onTransact in code is: 102
2020-12-19 22:23:29.799 30202-30202/com.rhkj.zhihuixue E/zhihuixue_:ZMainActivityPm32_1.init(Line:189): ----------32-1下标:4题目:TopicBean{id=23787, answer_time=0, status=3201, name=‘night;sweater;Sunday;spring;shorts‘, name_status=null, audio=‘http://oss.yyzxh.com/audio/1-3-5-1-121.mp3‘, p_id=1664, answer_id=‘126057‘, correct=‘shorts;night;sweater;Sunday;spring‘, attribute=null, evaluationcontent=null, text=null, choice=null, war_video=null, name_two=null, option=null, correct_two=null, item_bank_id=65129, right_audio=‘null‘, answer=[com.rhkj.zhihuixue.m_putong.bean.MPutongBean$TopicBean$AnswerBeanX@bfd059a]}
2020-12-19 22:23:29.800 735-30725/? E/HwExtendedCodec: mime: audio/mpeg matching compontent failed!
2020-12-19 22:23:29.802 749-3652/? E/OMXNodeInstance: setConfig(0xe6928ec0:google.mp3.decoder, ??(0x6f700006)) ERROR: Undefined(0x80001001)
2020-12-19 22:23:29.803 749-3652/? E/OMXNodeInstance: setConfig(0xe6928ec0:google.mp3.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
2020-12-19 22:23:29.803 30202-30202/com.rhkj.zhihuixue E/zhihuixue_:ZMainActivityPm32_1.init(Line:190): ----------32-1题目:TopicBean{id=23787, answer_time=0, status=3201, name=‘night;sweater;Sunday;spring;shorts‘, name_status=null, audio=‘http://oss.yyzxh.com/audio/1-3-5-1-121.mp3‘, p_id=1664, answer_id=‘126057‘, correct=‘shorts;night;sweater;Sunday;spring‘, attribute=null, evaluationcontent=null, text=null, choice=null, war_video=null, name_two=null, option=null, correct_two=null, item_bank_id=65129, right_audio=‘null‘, answer=[com.rhkj.zhihuixue.m_putong.bean.MPutongBean$TopicBean$AnswerBeanX@bfd059a]}
2020-12-19 22:23:29.878 1801-1825/? E/HsmCoreServiceImpl: onTransact in code is: 103
2020-12-19 22:23:30.035 30202-30734/com.rhkj.zhihuixue E/BaseSingEngine: before buildEngine
2020-12-19 22:23:30.035 30202-30734/com.rhkj.zhihuixue E/BaseSingEngine: after buildEngine and before buildAvd
2020-12-19 22:23:30.035 30202-30734/com.rhkj.zhihuixue E/BaseSingEngine: after buildAvd and before ssound_new
2020-12-19 22:23:30.036 30202-30734/com.rhkj.zhihuixue E/BaseSingEngine: NewCfg{"appKey":"a306","secretKey":"c11163aa6c834a028da4a4b30955bd86","logEnable":1,"logLevel":3,"prof":{"enable":1,"output":"\/storage\/emulated\/0\/Android\/data\/com.rhkj.zhihuixue\/files\/crash.txt"},"cloud":{"enable":1,"server":"wss:\/\/52.83.220.100","connectTimeout":20,"serverTimeout":60,"enableAsync":0}}
2020-12-19 22:23:30.036 30202-30734/com.rhkj.zhihuixue E/BaseSingEngine: after ssound_new
2020-12-19 22:23:30.037 30202-30734/com.rhkj.zhihuixue E/ssound_new: 线程ID:670
2020-12-19 22:23:30.108 735-30732/? E/NuCachedSource2: source returned error -1, 10 retries left
2020-12-19 22:23:33.224 769-816/? E/JankService: logCaptureFilter: not the beta version or delimitation frozen, no need to capture log
2020-12-19 22:23:33.224 769-816/? E/JankService: ### JankSchedHwRead error!
2020-12-19 22:23:33.226 769-816/? E/JankService: update dlm info failed
2020-12-19 22:23:33.246 769-816/? E/JankService: Failed to get thermalPath[1].
2020-12-19 22:23:33.306 735-30732/? E/NuCachedSource2: source returned error -1, 9 retries left
2020-12-19 22:23:36.071 1111-1111/? E/HwActivityManagerServiceEx: showAppEyeAnrUi null!
2020-12-19 22:23:36.503 735-30732/? E/NuCachedSource2: source returned error -1, 8 retries left
2020-12-19 22:23:37.897 1111-1200/? E/ActivityManager: ANR in com.rhkj.zhihuixue (com.rhkj.zhihuixue/.activity.zhijizhiyi.game.ZMainActivityPm32_1)
    PID: 30202
    Reason: Input dispatching timed out (Waiting because the touched window is paused.)
    Parent: com.rhkj.zhihuixue/.dialog.pc.Pc04Dialog
    Load: 45.42 / 45.47 / 45.93
    CPU usage from 174430ms to 0ms ago (2020-12-19 22:20:41.582 to 2020-12-19 22:23:36.012):
      22% 642/surfaceflinger: 15% user + 6.3% kernel / faults: 1212 minor
      12% 606/android.hardware.graphics.composer@2.2-service: 6.1% user + 6.7% kernel / faults: 10584 minor 1 major
      11% 1111/system_server: 8.3% user + 2.9% kernel / faults: 43819 minor 53 major
      6.5% 614/vendor.huawei.hardware.audio@4.0-service: 4.1% user + 2.4% kernel / faults: 8 minor
      4.6% 19806/adbd: 0.8% user + 3.8% kernel / faults: 1232172 minor
      3.7% 735/mediaserver: 2.3% user + 1.4% kernel / faults: 2889 minor
      3.4% 619/vendor.huawei.hardware.hwdisplay.displayengine@1.1-service: 2.7% user + 0.7% kernel
      2.9% 639/audioserver: 2.3% user + 0.6% kernel / faults: 921 minor 9 major
      2.9% 749/media.codec: 1.9% user + 1% kernel / faults: 1002 minor
      2.5% 3260/com.tencent.android.qqdownloader:daemon: 0.9% user + 1.6% kernel / faults: 7531 minor 987 major
      2.1% 761/vendor.huawei.hardware.sensors@1.0-service: 1% user + 1.1% kernel / faults: 2 minor
      2% 1704/com.android.systemui: 1.5% user + 0.5% kernel / faults: 11627 minor 1733 major
      1.8% 500/logd: 1.1% user + 0.7% kernel / faults: 27 minor
      1.5% 3778/com.huawei.intelligent: 1.2% user + 0.3% kernel / faults: 2730 minor 1353 major
      1.3% 22011/kworker/u17:1: 0% user + 1.3% kernel
      1.3% 679/aptouch_daemon: 1.1% user + 0.2% kernel / faults: 3 minor
      0.9% 717/vendor.huawei.hardware.dolby.dms@1.0-service: 0.4% user + 0.5% kernel
      0.8% 26481/com.xunmeng.pinduoduo: 0.5% user + 0.3% kernel / faults: 2344 minor 199 major
      0.8% 1911/com.android.phone: 0.6% user + 0.2% kernel / faults: 3044 minor 36 major
      0.8% 14880/cabc_pwm_task: 0% user + 0.8% kernel
      0.8% 3358/com.tencent.android.qqdownloader: 0.6% user + 0.1% kernel / faults: 8375 minor 412 major
      0.7% 3367/com.google.android.gms.persistent: 0.5% user + 0.2% kernel / faults: 5466 minor 116 major
      0.7% 30068/logcat: 0.2% user + 0.4% kernel / faults: 33248 minor
      0.7% 1890/com.huawei.powergenie: 0.4% user + 0.2% kernel / faults: 1311 minor 3 major
      0.7% 26392/com.xunmeng.pinduoduo:titan: 0.4% user + 0.2% kernel / faults: 1977 minor 122 major
      0.6% 27084/com.xunmeng.pinduoduo:support: 0.3% user + 0.2% kernel / faults: 2015 minor 196 major
      0.6% 7/rcu_preempt: 0% user + 0.6% kernel
      0.6% 26631/com.xunmeng.pinduoduo:lifecycle: 0.3% user + 0.2% kernel / faults: 2047 minor 98 major
      0.5% 28175/kworker/u17:2: 0% user + 0.5% kernel
      0.5% 644/powerlogd: 0.4% user + 0.1% kernel / faults: 12 minor
      0.5% 18499/com.rhkj.zhihuixue:pushcore: 0.4% user + 0.1% kernel / faults: 2948 minor
      0.4% 22255/kworker/0:0: 0% user + 0.4% kernel
      0.4% 769/hiview: 0.1% user + 0.3% kernel / faults: 250 minor 15 major
      0.4% 17927/kworker/u16:7: 0% user + 0.4% kernel
      0.4% 4455/com.baidu.input_huawei: 0.3% user + 0.1% kernel / faults: 7342 minor 1755 major
      0.4% 25462/kworker/u17:3: 0% user + 0.4% kernel
      0.4% 316/irq/352-thp: 0% user + 0.4% kernel
      0.4% 501/servicemanager: 0.1% user + 0.2% kernel
      0.3% 26719/kworker/u16:6: 0% user + 0.3% kernel
      0.2% 1873/com.huawei.HwOPServer: 0.1% user + 0.1% kernel / faults: 2570 minor 36 major
      0.2% 3327/com.tencent.mobileqq:MSF: 0.2% user + 0% kernel / faults: 446 minor 78 major
      0.2% 22354/kworker/u16:0: 0% user + 0.2% kernel
      0.2% 751/hwpged: 0% user + 0.2% kernel / faults: 115 minor
      0.2% 1738/kworker/u16:2: 0% user + 0.2% kernel
      0.1% 14914/kworker/u16:5: 0% user + 0.1% kernel
      0.2% 640/lmkd: 0% user + 0.2% kernel
      0.2% 9160/com.alibaba.android.rimet: 0.1% user + 0.1% kernel / faults: 1067 minor 389 major
      0.2% 3616/com.tencent.android.qqdownloader:tools: 0.1% user + 0.1% kernel / faults: 1779 minor 1652 major
      0.2% 963/glgps4774: 0.2% user + 0% kernel / faults: 1 minor
      0.2% 3386/com.huawei.health:DaemonService:
2020-12-19 22:23:37.897 1111-1200/? E/ActivityManager: CPU usage from 71ms to 585ms later (2020-12-19 22:23:36.082 to 2020-12-19 22:23:36.597):
      127% 1111/system_server: 80% user + 46% kernel / faults: 2258 minor 2 major
        57% 1200/ActivityManager: 16% user + 40% kernel
        55% 1123/HeapTaskDaemon: 55% user + 0% kernel
        6.3% 1120/FinalizerDaemon: 2.1% user + 4.2% kernel
        4.2% 1119/ReferenceQueueD: 4.2% user + 0% kernel
        2.1% 1522/SensorService: 2.1% user + 0% kernel
        2.1% 1598/HwDualSensorEve: 0% user + 2.1% kernel
      112% 30202/com.rhkj.zhihuixue: 17% user + 95% kernel / faults: 935 minor
        95% 30388/RxCachedThreadS: 7% user + 88% kernel
        7% 30214/Binder:30202_1: 7% user + 0% kernel
        3.5% 30230/Binder:30202_4: 3.5% user + 0% kernel
        3.5% 30285/Thread-43: 3.5% user + 0% kernel
        3.5% 30622/pool-7-thread-1: 0% user + 3.5% kernel
       +0% 30739/Binder:30202_6: 0% user + 0% kernel
      10% 614/vendor.huawei.hardware.audio@4.0-service: 8.1% user + 2% kernel
        8.1% 9013/effect: 8.1% user + 0% kernel
        2% 8989/writer: 0% user + 2% kernel
      6.2% 735/mediaserver: 0% user + 6.2% kernel
        2% 30725/NPDecoder: 0% user + 2% kernel
        2% 30726/NPDecoder-CL: 0% user + 2% kernel
      4.1% 639/audioserver: 4.1% user + 0% kernel
        4.1% 1223/AudioOut_D: 4.1% user + 0% kernel
      4.2% 761/vendor.huawei.hardware.sensors@1.0-service: 2.1% user + 2.1% kernel
      4.5% 3260/com.tencent.android.qqdownloader:daemon: 4.5% user + 0% kernel / faults: 5 minor
        2.2% 3408/MessengerServic: 2.2% user + 0% kernel
        2.2% 4585/pool-8-StatRepo: 0% user + 2.2% kernel
      1.9% 7/rcu_preempt: 0% user + 1.9% kernel
      1.9% 42/ksoftirqd/5: 0% user + 1.9% kernel
      1.9% 54/ksoftirqd/7: 0% user + 1.9% kernel
      1.9% 306/hw_kstate: 0% user + 1.9% kernel
      2% 567/netd: 0% user + 2% kernel / faults: 16 minor
      2% 642/surfaceflinger: 2% user + 0% kernel / faults: 1 minor
        2% 642/surfaceflinger: 0% user + 2% kernel
      2% 644/powerlogd: 2% user + 0% kernel
      2% 717/vendor.huawei.hardware.dolby.dms@1.0-service: 0% user + 2% kernel
        2% 717/dms@1.0-service: 0% user + 2% kernel
      2.1% 749/media.codec: 2.1% user + 0% kernel
        2.1% 30727/gle.mp3.decoder: 2.1% user + 0% kernel
        2.1% 30728/OMXCallbackDisp: 2.1% user + 0% kernel
      2.1% 790/chargemonitor: 0% user + 2.1% kernel
      2.1% 1890/com.huawei.powergenie: 0% user + 2.1% kernel / faults: 3 minor
        2.1% 5531/traffic stats: 0% user + 2.1% kernel
      2.3% 3358/com.tencent.android.qqdownloader: 2.3% user + 0% kernel / faults: 3 minor
        2.3% 3442/ReplyEventDispa: 2.3% user + 0% kernel
      2.4% 3778/com.huawei.intelligent: 0% user + 2.4% kernel
        2.4% 13870/amapLocCoreThre: 2.4% user + 0% kernel
      3% 14880/cabc_pwm_task: 0% user + 3% kernel
      3% 19806/adbd: 0% user + 3% kernel / faults: 2056 minor
        3% 19806/adbd: 0% user + 3% kernel
    34% TOTAL: 13% user + 20% kernel + 0.2% softirq
2020-12-19 22:23:37.905 1111-3238/? E/ReportTools: This is not beta user build
2020-12-19 22:23:37.914 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:37.914 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:38.063 629-13102/? E/uniperf server: uniPerfEvent doParse failed, cmdId=4400
2020-12-19 22:23:38.144 769-2736/? E/LOGSERVER_UTILS: get_iotrace:(114)   write [/sys/io_log_data/iotrace/io_data] failed.   return_len = -1   errno = 1   reason is [Operation not permitted]
2020-12-19 22:23:38.144 769-2736/? E/LOGSERVER_UTILS: dump_iotrace_to_file:(325)   get IOtrace failed.
2020-12-19 22:23:39.700 735-30732/? E/NuCachedSource2: source returned error -1, 7 retries left
2020-12-19 22:23:39.720 1111-1628/? E/RMS.HwSysResManagerService: Process Permission error! pid:1911 uid:1001 Process.myPid:1111
2020-12-19 22:23:41.144 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.205 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.241 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.241 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.241 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.244 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.244 769-2736/? E/iMonitor: FaultDetect: DUMPTOOL_PRINTF return.
2020-12-19 22:23:41.292 769-816/? E/JankService: logCaptureFilter: the special scene
2020-12-19 22:23:41.306 769-816/? E/JankService: Failed to get thermalPath[1].
2020-12-19 22:23:42.896 735-30732/? E/NuCachedSource2: source returned error -1, 6 retries left
2020-12-19 22:23:46.111 735-30732/? E/NuCachedSource2: source returned error -1, 5 retries left
2020-12-19 22:23:46.116 769-3071/? E/iMonitor: [ZeroHung]addPath: add path [/data/log/reliability/zerohung/uploading/20201219222346-09999-WP24-event.log]
2020-12-19 22:23:46.116 769-3071/? E/iMonitor: [ZeroHung]addPath: add_and_del_dynamic_path /data/log/reliability/zerohung/uploading/20201219222346-09999-WP24-event.log success
2020-12-19 22:23:46.116 769-3071/? E/iMonitor: [ZeroHung]addPath: add path [/data/log/reliability/zerohung/uploading/event.log]
2020-12-19 22:23:46.116 769-3071/? E/iMonitor: [ZeroHung]addPath: add_and_del_dynamic_path /data/log/reliability/zerohung/uploading/event.log success
2020-12-19 22:23:46.460 740-740/? E/Thermal-daemon: [ap] temp_new :37  temp_old :38
2020-12-19 22:23:46.461 740-740/? E/Thermal-daemon: Report temperature: [ap] temp :37  report_threshold:1
2020-12-19 22:23:49.340 735-30732/? E/NuCachedSource2: source returned error -1, 4 retries left
2020-12-19 22:23:52.569 735-30732/? E/NuCachedSource2: source returned error -1, 3 retries left
2020-12-19 22:23:55.849 735-30732/? E/NuCachedSource2: source returned error -1, 2 retries left
2020-12-19 22:23:55.938 1111-1111/? E/PowerManagerService: Exception when search wack lock :java.lang.IllegalArgumentException: Wake lock not active: android.os.Binder@5a51f79 from uid 1000
2020-12-19 22:23:57.056 769-3071/? E/iMonitor: [ZeroHung]waitUploadDone: wait for uploading folder empty timeout
2020-12-19 22:23:57.056 769-3071/? E/iMonitor: [ZeroHung]uploadEvent: hlogupl_send_event failed
2020-12-19 22:23:57.056 769-3071/? E/iMonitor: [ZeroHung]uploadEvent: hlogupl_pack_and_upload failed, num=1
2020-12-19 22:23:59.083 735-30732/? E/NuCachedSource2: source returned error -1, 1 retries left
2020-12-19 22:24:00.005 1704-1704/? E/DateView: DateView,mCurrentTime: 1608387840005
2020-12-19 22:24:00.031 1704-1704/? E/ndroid.systemu: No package ID ff found for ID 0xffffffff.
2020-12-19 22:24:00.034 1704-1704/? E/ndroid.systemu: No package ID ff found for ID 0xffffffff.
2020-12-19 22:24:02.260 735-30732/? E/NuCachedSource2: source returned error -1, 0 retries left
2020-12-19 22:24:02.457 732-5418/? E/AMRExtractor: read header failed!
2020-12-19 22:24:02.458 735-30731/? E/GenericSource: initFromDataSource, cannot create extractor!
2020-12-19 22:24:02.458 735-30731/? E/GenericSource: Failed to init from data source!
2020-12-19 22:24:02.459 30202-30739/com.rhkj.zhihuixue E/MediaPlayerNative: error (1, -2147483648)
2020-12-19 22:24:02.496 1854-3838/? E/OPCollectLog: HwForegroundAppAction:duplicate pkgName.
2020-12-19 22:24:02.496 3871-3886/? E/AppLifeChangeSensor:  CAWARENESS: activityResumed mAppLifeChangeCallback is null 
2020-12-19 22:24:02.513 642-971/? E/BufferQueueProducer: [] mConsumerName == NULL!!

 

 

首先,adb shell进入data/system目录下会看到一个叫做dropbox的文件夹

技术图片

 

 只要你的Android系统出现ANR或者Crash等,系统就会保存日志到这个文件夹中,对你分析问题的产生有巨大帮助。话不多说,我们把这个dropbox拷出来,看看里面的内容

可以看到,我们的CPU在发生ANR 的时候总共才使用了12%左右的性能。这里要注意了。

  1. 如果发生ANR的进程CPU占用较高,如到了80%或90%以上,则可以怀疑是应用内一些代码不合理消耗掉了CPU资源,比如死循环或者一些算法库进行大量高精度复杂运算导致CPU长期占用较高,这就要结合trace和ANR前后的log进一步分析了。
  2. 如果某些进程的CPU占用百分比较高,几乎占用了所有CPU资源,而发生ANR的进程CPU占用为0%或非常低,则认为CPU资源被占用,进程没有被分配足够的资源,从而发生了ANR。这种情况多数可以认为是系统状态的问题,并不是由本应用造成的。
  3. 如果CPU总用量不高,那么很有可能是一些耗时操作或者锁的问题使主线程被阻塞 ,导致ANR。
  4. 如果iowait 占用率过高,很可能是系统等待I/O耗时操作,导致ANR。



 

记录一下 小游戏模板里面遇到ANR

标签:image   secret   阻塞   null   support   bec   mda   bind   state   

原文地址:https://www.cnblogs.com/zhangxuetao/p/14161569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!