性能数据找不到应用id就退出
							parent
							
								
									3e36ba544c
								
							
						
					
					
						commit
						43c7fc7eb0
					
				| 
						 | 
				
			
			@ -347,7 +347,6 @@ public class IosDebuggerServiceImpl extends AbstractDebuggerService {
 | 
			
		|||
        iosDeviceInfoByPackageThread = new IOSDeviceInfoByPackageThread(info);
 | 
			
		||||
        iosDeviceInfoByPackageThread.start();
 | 
			
		||||
        queryDeviceInfoByPackageMap.put(info.getCaseId(), iosDeviceInfoByPackageThread);
 | 
			
		||||
        logger.debug("记录设备【{}】的应用的性能在任务【{}】中已经开启完毕..................................", info.getDeviceId(),info.getCaseId());
 | 
			
		||||
        IOSDeviceAllInfoThread deviceAllInfoThread = queryDeviceInfoMap.get(info.getCaseId());
 | 
			
		||||
        if (null != deviceAllInfoThread) {
 | 
			
		||||
            logger.debug("记录设备【{}】的性能数据,任务【{}】已经存在。。。。。。。。。。", info.getDeviceId(),info.getCaseId());
 | 
			
		||||
| 
						 | 
				
			
			@ -358,7 +357,6 @@ public class IosDebuggerServiceImpl extends AbstractDebuggerService {
 | 
			
		|||
        deviceAllInfoThread = new IOSDeviceAllInfoThread(info,iosDeviceInfoByPackageThread.getDeviceCpuNum());
 | 
			
		||||
        deviceAllInfoThread.start();
 | 
			
		||||
        queryDeviceInfoMap.put(info.getCaseId(), deviceAllInfoThread);
 | 
			
		||||
        logger.debug("记录设备【{}】的性能在任务【{}】中已经开启完毕..................................", info.getDeviceId(),info.getCaseId());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package net.northking.cctp.upperComputer.service.thread;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import net.northking.cctp.upperComputer.deviceManager.UpperComputerManager;
 | 
			
		||||
import net.northking.cctp.upperComputer.driver.adb.Adb;
 | 
			
		||||
import net.northking.cctp.upperComputer.driver.adb.AdbDevice;
 | 
			
		||||
import net.northking.cctp.upperComputer.driver.adb.AdbTransport;
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +80,7 @@ public class AndroidDeviceAllInfoThread extends Thread {
 | 
			
		|||
            logger.error("无法创建设备连接", e);
 | 
			
		||||
            throw new ParamMistakeException("当前设备未连接,监控设备性能失败");
 | 
			
		||||
        }
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			@ -202,7 +203,7 @@ public class AndroidDeviceAllInfoThread extends Thread {
 | 
			
		|||
 | 
			
		||||
    public String stopThread() {
 | 
			
		||||
        logger.info("收到设备【{}】的性能数据停止请求,任务id:{}。。。。。。", info.getDeviceId(), info.getCaseId());
 | 
			
		||||
        agentSession.send(CloseSessionCommand.getInstance());
 | 
			
		||||
        agentSession.closeSilence();
 | 
			
		||||
        exit = true;
 | 
			
		||||
        try {
 | 
			
		||||
            cpuOutPutStream.close();
 | 
			
		||||
| 
						 | 
				
			
			@ -212,7 +213,7 @@ public class AndroidDeviceAllInfoThread extends Thread {
 | 
			
		|||
        } catch (IOException e) {
 | 
			
		||||
            logger.error("文件流关闭异常", e);
 | 
			
		||||
        }
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package net.northking.cctp.upperComputer.service.thread;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import net.northking.cctp.upperComputer.deviceManager.UpperComputerManager;
 | 
			
		||||
import net.northking.cctp.upperComputer.driver.adb.Adb;
 | 
			
		||||
import net.northking.cctp.upperComputer.driver.adb.AdbDevice;
 | 
			
		||||
import net.northking.cctp.upperComputer.driver.adb.AdbTransport;
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +142,6 @@ public class AndroidDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
                    Thread.sleep(1000 - time);
 | 
			
		||||
                }
 | 
			
		||||
            } catch (InterruptedException exit) {
 | 
			
		||||
                Thread.currentThread().interrupt();
 | 
			
		||||
                break;
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                logger.error("获取安卓性能数据异常", e);
 | 
			
		||||
| 
						 | 
				
			
			@ -162,7 +162,7 @@ public class AndroidDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
            logger.error("文件流关闭异常", e);
 | 
			
		||||
        }
 | 
			
		||||
        logger.debug("文件流关闭");
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			@ -262,8 +262,9 @@ public class AndroidDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
 | 
			
		||||
    private List<String> getPid() {
 | 
			
		||||
        List<String> pids = null;
 | 
			
		||||
        AndroidAgentSession agentSession = null;
 | 
			
		||||
        try {
 | 
			
		||||
            AndroidAgentSession agentSession = new AndroidAgentSession(adbDevice, false);
 | 
			
		||||
            agentSession = new AndroidAgentSession(adbDevice, false);
 | 
			
		||||
            agentSession.start();
 | 
			
		||||
            List<RunningAppProcessInfo> runningAppProcessInfos = agentSession.send(RunningAppProcessInfoCommand.getInstance());
 | 
			
		||||
            if (!CollectionUtils.isEmpty(runningAppProcessInfos)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -282,6 +283,10 @@ public class AndroidDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
            }
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            logger.error("获取Pid失败", e);
 | 
			
		||||
        }finally {
 | 
			
		||||
            if (null != agentSession) {
 | 
			
		||||
                agentSession.closeSilence();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return pids;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -363,7 +368,9 @@ public class AndroidDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
    private float getFlow() {
 | 
			
		||||
        float downFlow = 0f;
 | 
			
		||||
        if (CollectionUtils.isEmpty(appProcessId)) {
 | 
			
		||||
            appProcessId = getPid();
 | 
			
		||||
            logger.warn("设备【{}】在任务【{}】中采集包【】性能数据未获取到应用启动的pid,可能应用已经退出了,退出采集..............",info.getDeviceId(),info.getCaseId(),info.getAppPackage());
 | 
			
		||||
//            stopThread();
 | 
			
		||||
//            appProcessId = getPid();
 | 
			
		||||
        }
 | 
			
		||||
        if (CollectionUtils.isEmpty(appProcessId)) {
 | 
			
		||||
            return 0f;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package net.northking.cctp.upperComputer.service.thread;
 | 
			
		|||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import net.northking.cctp.upperComputer.deviceManager.UpperComputerManager;
 | 
			
		||||
import net.northking.cctp.upperComputer.enums.FileBusinessTypeEnum;
 | 
			
		||||
import net.northking.cctp.upperComputer.entity.Attachment;
 | 
			
		||||
import net.northking.cctp.upperComputer.entity.DebuggerDeviceInfo;
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +64,7 @@ public class IOSDeviceAllInfoThread extends Thread {
 | 
			
		|||
            logger.error("开启性能获取失败", e);
 | 
			
		||||
        }
 | 
			
		||||
        logger.info("设备性能开始完毕。。。。。。。cpuNum:{},任务id:{}",cpuNum,info.getCaseId());
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			@ -176,7 +177,7 @@ public class IOSDeviceAllInfoThread extends Thread {
 | 
			
		|||
        } catch (IOException e) {
 | 
			
		||||
            logger.error("文件流关闭异常", e);
 | 
			
		||||
        }
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package net.northking.cctp.upperComputer.service.thread;
 | 
			
		|||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import net.northking.cctp.upperComputer.deviceManager.UpperComputerManager;
 | 
			
		||||
import net.northking.cctp.upperComputer.enums.FileBusinessTypeEnum;
 | 
			
		||||
import net.northking.cctp.upperComputer.entity.Attachment;
 | 
			
		||||
import net.northking.cctp.upperComputer.entity.DebuggerDeviceInfo;
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +66,7 @@ public class IOSDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
        } catch (IOException e) {
 | 
			
		||||
            logger.error("开启性能获取失败", e);
 | 
			
		||||
        }
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			@ -176,7 +177,7 @@ public class IOSDeviceInfoByPackageThread extends Thread {
 | 
			
		|||
        } catch (IOException e) {
 | 
			
		||||
            logger.error("文件流关闭异常", e);
 | 
			
		||||
        }
 | 
			
		||||
        String stfPath = SpringUtils.getProperties("nk.mobile-computer.stfPath");
 | 
			
		||||
        String stfPath = UpperComputerManager.getInstance().getApplicationPath();
 | 
			
		||||
        File dir = new File(stfPath + "/perInfoTmp/");
 | 
			
		||||
        if (!dir.exists()) {
 | 
			
		||||
            dir.mkdirs();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue