Package org.jboss.dna.common.math

Examples of org.jboss.dna.common.math.Duration$Components


     */
    public void stop() {
        if (this.isRunning()) {
            long duration = System.nanoTime() - this.lastStarted;
            this.lastStarted = 0l;
            this.stats.add(new Duration(duration));
        }
    }
View Full Code Here


     * Get the median duration that this stopwatch has recorded.
     * @return the median duration, or an empty duration if this stopwatch has not been used since creation or being
     * {@link #reset() reset}
     */
    public Duration getMedianDuration() {
        return this.detailedStats != null ? this.detailedStats.getMedian() : new Duration(0l);
    }
View Full Code Here

     */
    public void stop() {
        if (this.isRunning()) {
            long duration = System.nanoTime() - this.lastStarted;
            this.lastStarted = 0l;
            this.stats.add(new Duration(duration));
        }
    }
View Full Code Here

     * Get the median duration that this stopwatch has recorded.
     * @return the median duration, or an empty duration if this stopwatch has not been used since creation or being
     * {@link #reset() reset}
     */
    public Duration getMedianDuration() {
        return this.detailedStats != null ? this.detailedStats.getMedian() : new Duration(0l);
    }
View Full Code Here

    private Duration duration;

    @Before
    public void beforeEach() throws Exception {
        this.duration = new Duration(0);
    }
View Full Code Here

    @Test
    public void shouldRepresentTimeInProperFormat() {
        this.duration = this.duration.add(2, TimeUnit.SECONDS);
        assertEquals("00:00:02.000", this.duration.toString());

        this.duration = new Duration(1100, TimeUnit.MILLISECONDS);
        this.duration = this.duration.add(1 * 60, TimeUnit.SECONDS);
        this.duration = this.duration.add(1 * 60 * 60, TimeUnit.SECONDS);
        assertEquals("01:01:01.100", this.duration.toString());

        this.duration = new Duration(30100123, TimeUnit.MICROSECONDS);
        this.duration = this.duration.add(20 * 60, TimeUnit.SECONDS);
        this.duration = this.duration.add(10 * 60 * 60, TimeUnit.SECONDS);
        assertEquals("10:20:30.100,123", this.duration.toString());
    }
View Full Code Here

        sw.start();
        SearchEngineIndexer indexer = new SearchEngineIndexer(context, searchEngine, connectionFactory);
        indexer.indexAllWorkspaces();
        indexer.close();
        sw.stop();
        Duration zeroth = sw.getTotalDuration();
        System.out.println("Time to prime search engine:                 " + zeroth);

        // First load the content into the unsearched source ...
        sw.reset();
        sw.start();
        loadContent(unsearchedContent);
        sw.stop();
        Duration first = sw.getTotalDuration();

        // Now load the same content into the searchable source ...
        sw.reset();
        sw.start();
        loadContent(content);
        sw.stop();
        Duration second = sw.getTotalDuration();

        // And measure the time required to re-index ...
        sw.reset();
        sw.start();
        indexer = new SearchEngineIndexer(context, searchEngine, connectionFactory);
        indexer.indexAllWorkspaces();
        indexer.close();
        sw.stop();
        Duration third = sw.getTotalDuration();

        int percentOfLoading = (int)(((second.floatValue() / first.floatValue())) * 100.0f);
        System.out.println("Time to load content without indexing:       " + first);
        System.out.println("Time to load content and updating indexes:   " + second + "  (" + percentOfLoading
                           + "% of loading w/o indexing)");
        Duration loadingDiff = second.subtract(first);
        System.out.println("Time to update indexes during loading:       " + loadingDiff);
        int percentChange = (int)((((third.floatValue() - loadingDiff.floatValue()) / loadingDiff.floatValue())) * 100.0f);
        if (percentChange >= 0) {
            System.out.println("Time to re-index all content:                " + third + "  (" + percentChange
                               + "% more than indexing time during loading)");
        } else {
            System.out.println("Time to re-index all content:                " + third + "  (" + percentChange
View Full Code Here

     */
    public void stop() {
        if (this.isRunning()) {
            long duration = System.nanoTime() - this.lastStarted;
            this.lastStarted = 0l;
            this.stats.add(new Duration(duration));
        }
    }
View Full Code Here

     *
     * @return the median duration, or an empty duration if this stopwatch has not been used since creation or being
     *         {@link #reset() reset}
     */
    public Duration getMedianDuration() {
        return this.detailedStats != null ? this.detailedStats.getMedian() : new Duration(0l);
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.common.math.Duration$Components

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.