public static void main()

in benchmark/src/main/java/org/apache/james/mime4j/LongMultipartReadBench.java [44:85]


    public static void main(String[] args) throws Exception {

        byte[] content = loadMessage("long-multipart.msg");
        if (content == null) {
            System.err.println("Test message not found");
            return;
        }

        int testNumber = args.length > 0 ? Integer.parseInt(args[0]) : 0;

        Test test = createTest(testNumber);
        if (test == null) {
            System.err.println("No such test: " + testNumber);
            return;
        }

        int repetitions = args.length > 1 ? Integer.parseInt(args[1]) : 25000;

        System.out.println("Multipart message read.");
        System.out.println("No of repetitions: " + repetitions);
        System.out.println("Content length: " + content.length);
        System.out.println("Test: " + test.getClass().getSimpleName());

        System.out.print("Warmup... ");
        long t0 = System.currentTimeMillis();
        while (System.currentTimeMillis() - t0 < 1500) {
            test.run(content, 10);
        }
        System.out.println("done");

        System.out.println("--------------------------------");

        long start = System.currentTimeMillis();
        test.run(content, repetitions);
        long finish = System.currentTimeMillis();

        double seconds = (finish - start) / 1000.0;
        double mb = content.length * repetitions / 1024.0 / 1024;
        System.out.printf("Execution time: %f sec\n", seconds);
        System.out.printf("%.2f messages/sec\n", repetitions / seconds);
        System.out.printf("%.2f mb/sec\n", mb / seconds);
    }