【求助】华为云手机运行基于Cocos开发的游戏,CPU利用率100%

在华为CPH服务的云手机内,运行基于Cocos2dx开发的游戏

	行   15: 11-24 21:18:44.830   287  6776 E ActivityTaskManager: With Android 15 BAL hardening this activity start may be blocked if the PI creator upgrades target_sdk to 35+!  (missing opt in by PI creator)![callingPackage: com.android.launcher3; callingPackageTargetSdk: 28; callingUid: 1000; callingPid: 1029; appSwitchState: 2; callingUidHasAnyVisibleWindow: true; callingUidProcState: PERSISTENT; isCallingUidPersistentSystemProcess: true; forcedBalByPiSender: BSP.NONE; intent: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.fgcq.a143097/org.cocos2dx.cpp.AppActivity bnds=[38,392][289,696] }; callerApp: ProcessRecord{669cd14 1029:com.android.launcher3/1000}; inVisibleTask: true; balAllowedByPiCreator: BSP.ALLOW_BAL; balAllowedByPiCreatorWithHardening: BSP.ALLOW_BAL; resultIfPiCreatorAllowsBal: BAL_ALLOW_ALLOWLISTED_UID; hasRealCaller: true; isCallForResult: false; isPendingIntent: false; autoOptInReason: null; realCallingPackage: com.android.launcher3; realCallingPackageTargetSdk: 28; realCallingUid: 1000; realCallingPid: 1029; realCallingUidHasAnyVisibleWindow: true; realCallingUidProcState: PERSISTENT; isRealCallingUidPersistentSystemProcess: true; originatingPendingIntent: null; realCallerApp: ProcessRecord{669cd14 1029:com.android.launcher3/1000}; realInVisibleTask: true; balAllowedByPiSender: BSP.ALLOW_BAL; resultIfPiSenderAllowsBal: BAL_ALLOW_ALLOWLISTED_UID]
	行   21: 11-24 21:18:44.837   287  6776 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.fgcq.a143097/org.cocos2dx.cpp.AppActivity bnds=[38,392][289,696]} with LAUNCH_MULTIPLE from uid 1000 (BAL_ALLOW_ALLOWLISTED_UID) result code=0
	行   29: 11-24 21:18:44.837   554   612 V WindowManagerShell: Transition requested (#27): android.os.BinderProxy@87850ec TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=27 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.fgcq.a143097/org.cocos2dx.cpp.AppActivity } baseActivity=ComponentInfo{com.fgcq.a143097/org.cocos2dx.cpp.AppActivity} topActivity=ComponentInfo{com.fgcq.a143097/org.cocos2dx.cpp.AppActivity} origActivity=null realActivity=ComponentInfo{com.fgcq.a143097/org.cocos2dx.cpp.AppActivity} numActivities=1 lastActiveTime=448508534 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@66a8cb5} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{b3b3f4a org.cocos2dx.cpp.AppActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=1080 topActivityLetterboxHeight=1920 isUserFullscreenOverrideEnabled=false isSystemFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = null, displayChange = null, flags = 0, debugId = 27 }
	行   31: 11-24 21:18:44.849   287   348 I ActivityManager: Start proc 6822:com.fgcq.a143097/u0a87 for next-top-activity {com.fgcq.a143097/org.cocos2dx.cpp.AppActivity}
	行   46: 11-24 21:18:44.879   287   337 V WindowManager: Sent Transition (#27) createdAt=11-24 21:18:44.832 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=27 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.fgcq.a143097/org.cocos2dx.cpp.AppActivity } baseActivity=ComponentInfo{com.fgcq.a143097/org.cocos2dx.cpp.AppActivity} topActivity=ComponentInfo{com.fgcq.a143097/org.cocos2dx.cpp.AppActivity} origActivity=null realActivity=ComponentInfo{com.fgcq.a143097/org.cocos2dx.cpp.AppActivity} numActivities=1 lastActiveTime=448508534 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{RemoteToken{611594b Task{aaf3e5e #27 type=standard A=10087:com.fgcq.a143097}}} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{7c98b99 org.cocos2dx.cpp.AppActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=1080 topActivityLetterboxHeight=1920 isUserFullscreenOverrideEnabled=false isSystemFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = null, displayChange = null, flags = 0, debugId = 27 }
	行  253: 11-24 21:18:45.139  6822  6822 W BootstrapClass:        at org.cocos2dx.cpp.CQGameApplication.onCreate(CQGameApplication.java:24)
	行  435: 11-24 21:18:45.244  6822  6822 D main    : cocos_android_app_init
	行  436: 11-24 21:18:45.244  6822  6822 I cp-sqSdkHotfix:  onActivityCreated ClassName: org.cocos2dx.cpp.AppActivity
	行  438: 11-24 21:18:45.252  6822  6822 D Cocos2dxHelper: isSupportLowLatency:false
	行  439: 11-24 21:18:45.254  6822  6822 D Cocos2dxHelper: sampleRate: 48000, framesPerBuffer: 960
	行  441: 11-24 21:18:45.258  6822  6822 D Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 48000, bufferSizeInFrames: 960
	行  450: 11-24 21:18:45.273  6822  6822 D Cocos2dxActivity: model=sayram
	行  451: 11-24 21:18:45.273  6822  6822 D Cocos2dxActivity: product=sayram
	行  452: 11-24 21:18:45.273  6822  6822 D Cocos2dxActivity: isEmulator=false
	行  476: 11-24 21:18:45.290  6822  6822 D Cocos2dxActivity: onResume()
	行  482: 11-24 21:18:45.328   287  6776 D CoreBackPreview: Window{57d4e83 u0 com.fgcq.a143097/org.cocos2dx.cpp.AppActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@43bde7e, mPriority=0, mIsAnimationCallback=false}
	行  492: 11-24 21:18:45.583  6822  6870 D cocos2d-x debug info: [LUA-print]


运行2-3天以后,发现GL Thread线程 CPU持续占用100%,求助专家帮忙分析一下。
疑似异常的线程

800%cpu 101%user   0%nice  10%sys 689%idle   0%iow   0%irq   0%sirq   0%host
  TID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ THREAD          PROCESS                                                                                 
23445 u0_a87       20   0  35G 768M 234M R 99.6  15.6 278:50.94 GLThread 40     com.fgcq.a143097
30425 root         20   0  10G 6.2M 4.2M R  3.0   0.1   0:02.53 top             top
23777 u0_a87       20   0  35G 768M 234M S  1.6  15.6  36:21.28 GLThread 40     com.fgcq.a143097
23759 u0_a87        4 -16  35G 768M 234M S  0.6  15.6  21:00.85 AudioTrack      com.fgcq.a143097
23749 u0_a87       20   0  35G 768M 234M S  0.6  15.6  42:21.54 GLThread 40     com.fgcq.a143097
23506 u0_a87       20   0  35G 768M 234M S  0.6  15.6  58:10.62 GLThread 40     com.fgcq.a143097
 1967 audioserver   1 -19  11G  35M  29M S  0.6   0.7  12:12.40 writer          audioserver
 1226 network_sta+ 20   0  14G 132M  73M S  0.6   2.6  25:50.22 IpClient.wlan0  com.android.networkstack.process

正常运行的线程

800%cpu  37%user   0%nice  30%sys 733%idle   0%iow   0%irq   0%sirq   0%host
  TID USER         PR  NI VIRT  RES  SHR S[%CPU] %MEM     TIME+ THREAD          PROCESS
 6870 u0_a87       20   0  35G 804M 230M R 19.6  16.3   0:36.52 GLThread 39     com.fgcq.a143097
 6558 mediacodec   10 -10  11G  31M  27M S  4.6   0.6   0:21.59 id.opus.encoder media.swcodec
 7346 root         20   0  10G 6.3M 4.1M R  4.0   0.1   0:00.16 top             top
 6550 root         10 -10  15G 167M 115M S  3.6   3.3   0:23.94 MediaCodec_loop app_process
 7226 u0_a87       20   0  35G 804M 230M S  2.3  16.3   0:04.35 GLThread 39     com.fgcq.a143097
 6849 mediacodec   10 -10  13G  26M  21M S  2.3   0.5   0:11.47 ult.avc.encoder android.hardware.media.c2@1.0-service-default
  155 system       12  -8  11G  57M  34M S  2.3   1.1   2:32.87 surfaceflinger  surfaceflinger
 7252 u0_a87       20   0  35G 804M 230M S  1.6  16.3   0:02.32 GLThread 39     com.fgcq.a143097
 6931 u0_a87       20   0  35G 804M 230M S  1.6  16.3   0:04.44 GLThread 39     com.fgcq.a143097
  194 system       12  -8  11G  57M  34M S  1.3   1.1   1:44.33 RenderEngine    surfaceflinger
 7155 root         20   0  15G 167M 115M S  1.0   3.3   0:02.56 binder:6529_7   app_process
 6587 root         20   0  15G 167M 115M S  1.0   3.3   0:04.61 audio-out       app_process
 6569 audioserver   1 -19  11G  35M  29M S  1.0   0.7   0:01.68 AudioOut_25     audioserver
 6556 root         10 -10  15G 167M 115M S  1.0   3.3   0:06.67 HwBinder:6529_1 app_process
  779 network_sta+ 20   0  14G 132M  72M S  1.0   2.6   0:40.71 IpClient.wlan0  com.android.networkstack.process


通过 perf分析 发现GL Thread线程 ,火焰图如下libMyGame.so 是Cocos的类,求助帮忙指导一下,主要CPU消耗在哪里