JETM 下载

Download

使用

    @Test
    public void hello() throws InterruptedException {
        BasicEtmConfigurator.configure(true);
        etmMonitor.start();
        EtmPoint etmPoint = etmMonitor.createPoint("SETest:hello");
        System.out.println("hello world");
        Thread.currentThread().sleep(2 * 1000);

        nested();
        nested();
        sayf();

        etmPoint.collect();

        // visualize results
        etmMonitor.render(new SimpleTextRenderer());


        etmMonitor.stop();
    }

    private static void nested() throws InterruptedException {
        EtmPoint etmPoint = etmMonitor.createPoint("SETest:nested");
        System.out.println("in nested");
        Thread.currentThread().sleep(2*1000);
        etmPoint.collect();
    }

    private static void sayf() throws InterruptedException {
        EtmPoint etmPoint = etmMonitor.createPoint("SETest:sayf");
        System.out.println("in nested");
        Thread.currentThread().sleep(2*1000);
        nested();
        etmPoint.collect();
    }

输出结果:

[INFO ] [EtmMonitor] JETM 1.2.3 started.
hello world
in nested
in nested
in nested
in nested
|-------------------|---|------------|------------|------------|------------|
| Measurement Point | # |   Average  |     Min    |     Max    |    Total   |
|-------------------|---|------------|------------|------------|------------|
| SETest:hello      | 1 | 10,000.900 | 10,000.900 | 10,000.900 | 10,000.900 |
|   SETest:sayf     | 1 |  4,000.296 |  4,000.296 |  4,000.296 |  4,000.296 |
|     SETest:nested | 1 |  2,000.118 |  2,000.118 |  2,000.118 |  2,000.118 |
|   SETest:nested   | 2 |  2,000.159 |  2,000.136 |  2,000.182 |  4,000.317 |
|-------------------|---|------------|------------|------------|------------|
[INFO ] [EtmMonitor] Shutting down JETM.

Process finished with exit code 0