### Question:
ProcessStateCalculator { public FullState getCurrentFullState(int pid) { try { CpuState cpuState = StatParser.getInstance().parseCpuInfo(); File processFile = new File("/proc", String.valueOf(pid)); ProcessState processState = StatParser.getInstance().parseProcessInfo(pid); File taskFile = new File(processFile, "task"); File[] taskFiles = taskFile.listFiles(); if (!taskFile.exists() || taskFiles == null) { return null; } Map<Integer, ThreadState> threadInfo = getThreadInfo(pid, taskFiles); return new FullState(cpuState, processState, threadInfo); } catch (IOException e) { LOGGER.error("get current process state error"); return null; } } private  ProcessStateCalculator(); Map<Integer, Double> threadCpuMinuteUsage(int pid); void startRecordFullStat(int pid); Map<Integer, Double> endRecordFullStat(int pid); FullState getCurrentFullState(int pid); static ProcessStateCalculator getInstance();  }### Answer:
@Test public void testPS() throws InterruptedException { FullState fullState = processStateCalculator.getCurrentFullState(pid); System.out.println(fullState.cpuState.totalTime()); System.out.println(fullState.cpuState.idleTime); System.out.println(ProcUtil.formatJiffies(fullState.cpuState.totalTime())); System.out.println(fullState.processState.totalTime()); System.out.println(ProcUtil.formatJiffies(fullState.processState.totalTime())); for (Map.Entry<Integer, ThreadState> entry : fullState.threadInfo.entrySet()) { System.out.println("线程id: " + entry.getKey() + " : " + ProcUtil.formatJiffies(entry.getValue().totalTime())); } }