Package com.proofpoint.units

Examples of com.proofpoint.units.Duration


        assertLegacyEquivalence(StoreConfig.class, currentProperties, oldProperties);
    }

    @Test
    public void testMinTtl() {
        assertValidates(new StoreConfig().setTtl(new Duration(1, TimeUnit.MINUTES)));
        assertFailsValidation(new StoreConfig().setTtl(new Duration(59, TimeUnit.SECONDS)),
                "ttl", "must be at least 1m", MinDuration.class);
    }
View Full Code Here


    @Test
    public void testTtl()
            throws InterruptedException
    {
        StoreConfig config = new StoreConfig();
        config.setTtl(new Duration(1, TimeUnit.MILLISECONDS));

        PersonStore store = new PersonStore(config, new InMemoryEventClient());
        store.put("foo", createPerson("foo@example.com", "Mr Foo"));
        Thread.sleep(2);
        Assert.assertNull(store.get("foo"));
View Full Code Here

        }
        while (elapsed < totalNanos);

        long benchmarkElapsed = System.nanoTime() - benchmarkStart;

        return new Results(new Duration(benchmarkElapsed, TimeUnit.NANOSECONDS), operations);
    }
View Full Code Here

            return operations / time.getValue(TimeUnit.SECONDS);
        }

        public Duration getTimePerOperation()
        {
            return new Duration(time.getValue(TimeUnit.MILLISECONDS) / operations, TimeUnit.MILLISECONDS);
        }
View Full Code Here

        add(timeUnit.toNanos(value));
    }

    public void add(double value, TimeUnit timeUnit)
    {
        add(new Duration(value, timeUnit).roundTo(NANOSECONDS));
    }
View Full Code Here

        add(timeUnit.toNanos(value));
    }

    public void add(double value, TimeUnit timeUnit)
    {
        add(new Duration(value, timeUnit).roundTo(TimeUnit.NANOSECONDS));
    }
View Full Code Here

        return sample.percentiles(0.999)[0];
    }

    public void addValue(double value, TimeUnit timeUnit)
    {
        addValue(new Duration(value, timeUnit));
    }
View Full Code Here

public class BenchmarkQuantileDigest
{
    public static void main(String[] args)
            throws Exception
    {
        Duration warmupTime = new Duration(3, TimeUnit.SECONDS);
        Duration benchmarkTime = new Duration(5, TimeUnit.SECONDS);

        final QuantileDigest digest = new QuantileDigest(0.01, 0, new TestingTicker(), true);
        final Random random = new Random();

        Benchmark.Results results = Benchmark.run(new Runnable() {
View Full Code Here

        SparseTimeStat stat = new SparseTimeStat();
        stat.setBucketIdProvider(bucketIdProvider);
        stat.add(1, MILLISECONDS);
        assertPreviousDistributionEmpty(stat);
        ++bucketIdProvider.id;
        stat.add(new Duration(2, MILLISECONDS));
        stat.add(3_000_000, NANOSECONDS);
        assertPreviousDistribution(stat, 1, .001, .001, .001);
        ++bucketIdProvider.id;
        assertPreviousDistribution(stat, 2, .002, .003, .005);
    }
View Full Code Here

TOP

Related Classes of com.proofpoint.units.Duration

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.