Package xbird.util.distribution

Examples of xbird.util.distribution.ZipfGenerator


        runAllBenchmarksWithRandomDistribution(1024, 10000000);
    }

    private static void runAllBenchmarksWithZipfDistribution(int capacity, int round) {
        // skew 1.0
        ZipfGenerator zipf1 = new ZipfGenerator(2.0d);
        long[] data = new long[round];
        for(int i = 0; i < round; i++) {
            data[i] = Math.abs(zipf1.nextLong()) % round;
        }
        runBenchmarkWithZipfDistribution(capacity, round, 1.0, data, ReplacementAlgorithm.GClockK);
        runBenchmarkWithZipfDistribution(capacity, round, 1.0, data, ReplacementAlgorithm.GClock);
        runBenchmarkWithZipfDistribution(capacity, round, 1.0, data, ReplacementAlgorithm.LRU);
        // skew 0.8
        ZipfGenerator zipf2 = new ZipfGenerator(1.8d);
        for(int i = 0; i < round; i++) {
            data[i] = Math.abs(zipf2.nextLong()) % round;
        }
        runBenchmarkWithZipfDistribution(capacity, round, 0.8, data, ReplacementAlgorithm.GClockK);
        runBenchmarkWithZipfDistribution(capacity, round, 0.8, data, ReplacementAlgorithm.GClock);
        runBenchmarkWithZipfDistribution(capacity, round, 0.8, data, ReplacementAlgorithm.LRU);
        // skew 0.5
        ZipfGenerator zipf3 = new ZipfGenerator(1.5d);
        for(int i = 0; i < round; i++) {
            data[i] = Math.abs(zipf3.nextLong()) % round;
        }
        runBenchmarkWithZipfDistribution(capacity, round, 0.5, data, ReplacementAlgorithm.GClockK);
        runBenchmarkWithZipfDistribution(capacity, round, 0.5, data, ReplacementAlgorithm.GClock);
        runBenchmarkWithZipfDistribution(capacity, round, 0.5, data, ReplacementAlgorithm.LRU);
    }
View Full Code Here

TOP

Related Classes of xbird.util.distribution.ZipfGenerator

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.