Ignore:
Timestamp:
2016-02-09T18:58:37+01:00 (8 years ago)
Author:
bastiK
Message:

add test output for the Jenkins Measurement Plots Plugin

Location:
trunk/test/performance/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/PerformanceTestUtils.java

    r9205 r9771  
    1616        private String name;
    1717        private long time;
     18        private boolean measurementPlotsPlugin = false;
    1819
    1920        protected PerformanceTestTimer(String name) {
     
    2324
    2425        /**
     26         * Activate output for the Jenkins Measurement Plots Plugin.
     27         * @param active true if it should be activated
     28         */
     29        public void setMeasurementPlotsPluginOutput(boolean active) {
     30            measurementPlotsPlugin = active;
     31        }
     32        /**
    2533         * Prints the time since this timer was created.
    2634         */
    2735        public void done() {
    28             long dTime = System.nanoTime() - time;
    29             System.out.println("TIMER " + name + ": " + dTime / 1000000 + "ms");
     36            long dTime = (System.nanoTime() - time) / 1000000;
     37            if (measurementPlotsPlugin) {
     38                System.out.println(String.format("<measurement><name>%s (ms)</name><value>%.1f</value></measurement>", name, (double)dTime));
     39            } else {
     40                System.out.println("TIMER " + name + ": " + dTime + "ms");
     41            }
    3042        }
    3143    }
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java

    r9458 r9771  
    101101        data.generateDataSet();
    102102        CssGenerator css = new CssGenerator(data).addKeyValueRules(TEST_RULE_COUNT);
    103         runTest(data, css, "only key=value rules");
     103        runTest(data, css, "only key=value rules", false);
    104104    }
    105105
     
    112112        data.generateDataSet();
    113113        CssGenerator css = new CssGenerator(data).addHasKeyRules(TEST_RULE_COUNT);
    114         runTest(data, css, "only has key rules");
     114        runTest(data, css, "only has key rules", false);
    115115    }
    116116
     
    123123        data.generateDataSet();
    124124        CssGenerator css = new CssGenerator(data).addKeyRegexpRules(TEST_RULE_COUNT);
    125         runTest(data, css, "regular expressions");
     125        runTest(data, css, "regular expressions", true);
    126126    }
    127127
     
    134134        data.generateDataSet();
    135135        CssGenerator css = new CssGenerator(data).addIsTrueRules(TEST_RULE_COUNT);
    136         runTest(data, css, "is true");
     136        runTest(data, css, "is true", false);
    137137    }
    138138
    139     private void runTest(KeyValueDataGenerator data, CssGenerator css, String description) {
     139    private void runTest(KeyValueDataGenerator data, CssGenerator css, String description, boolean measurementPlotsPlugin) {
    140140        MapCSSStyleSource source = new MapCSSStyleSource(css.getCss());
    141141        PerformanceTestTimer timer = PerformanceTestUtils.startTimer("MapCSSStyleSource#loadStyleSource(...) for " + description);
     
    143143        timer.done();
    144144
    145         timer = PerformanceTestUtils.startTimer(APPLY_CALLS + "x MapCSSStyleSource#apply(...) for " + description);
     145        if (measurementPlotsPlugin) {
     146            timer = PerformanceTestUtils.startTimer(description);
     147            timer.setMeasurementPlotsPluginOutput(true);
     148        } else {
     149            timer = PerformanceTestUtils.startTimer(APPLY_CALLS + "x MapCSSStyleSource#apply(...) for " + description);
     150        }
    146151        for (int i = 0; i < APPLY_CALLS; i++) {
    147152            MultiCascade mc = new MultiCascade();
Note: See TracChangeset for help on using the changeset viewer.