Java 耗时统计方法 StopWatch

    public String importDay() {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start("循环插入");

        int successNum = 0;
        String path = "E:/ruoyi/stock/";
        File[] childrenFiles = new File(path).listFiles();
        for (File childFile : childrenFiles) {
            if (readTxt(childFile) > 0) {
                successNum++;
                System.out.println("导入第" + successNum + "个文件 " + childFile.getName()+"===============================================");
            }
        }

        stopWatch.stop();
        String result="成功导入" + successNum + "个文件,耗时" + stopWatch.getTotalTimeSeconds() + "秒";
        System.out.println(result);
        return result;
    }

你可能感兴趣的:(java,python,前端)