Search in sources :

Example 26 with Stopwatch

use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.

the class WriteReadTest method doTest.

public void doTest() {
    Stopwatch runSW;
    runSW = new SimpleStopwatch();
    for (int i = 0; i < numThreads; i++) {
        new Thread(this).start();
    }
    try {
        runningSem.acquire();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    runSW.stop();
    out.printf("Elapsed: %f\n", runSW.getElapsedSeconds());
}
Also used : Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch)

Example 27 with Stopwatch

use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.

the class TreeMapTest method runTest.

public void runTest(double durationSeconds) {
    Stopwatch sw;
    Random random;
    double secondsPerAccess;
    double usPerAccess;
    long totalAccesses;
    totalAccesses = 0;
    random = new Random();
    sw = new SimpleStopwatch();
    while (sw.getSplitSeconds() < durationSeconds) {
        for (int i = 0; i < batchSize; i++) {
            long key;
            Map.Entry<Long, Integer> entry;
            key = random.nextLong();
            entry = ring.ceilingEntry(key);
        }
        totalAccesses += batchSize;
    }
    sw.stop();
    secondsPerAccess = sw.getElapsedSeconds() / (double) totalAccesses;
    usPerAccess = secondsPerAccess * 1e6;
    System.out.println("usPerAccess:\t" + usPerAccess);
}
Also used : Random(java.util.Random) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 28 with Stopwatch

use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.

the class SKFSNamespaceCreator method createNamespace.

public void createNamespace(String namespace, NamespaceOptions nsOptions) throws NamespaceCreationException {
    Stopwatch sw;
    sw = new SimpleStopwatch();
    session.createNamespace(namespace, nsOptions);
    sw.stop();
    Log.warning("Created namespace: " + namespace + "\tElapsed: " + sw.getElapsedSeconds());
}
Also used : Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch)

Example 29 with Stopwatch

use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.

the class LZ4 method compressFile.

private static final Pair<Triple<Double, Double, Double>, Pair<Integer, Integer>> compressFile(File file) throws IOException {
    Stopwatch readingSW;
    Stopwatch compressionSW;
    Stopwatch decompressionSW;
    byte[] original;
    byte[] compressed;
    byte[] uncompressed;
    readingSW = new SimpleStopwatch();
    System.out.printf("Reading file:          %s\n", file);
    original = FileUtil.readFileAsBytes(file);
    readingSW.stop();
    System.out.printf("Reading elapsed:       %f\n", readingSW.getElapsedSeconds());
    compressionSW = new SimpleStopwatch();
    compressed = new LZ4().compress(original, 0, original.length);
    compressionSW.stop();
    System.out.printf("Compression elapsed:   %f\n", compressionSW.getElapsedSeconds());
    decompressionSW = new SimpleStopwatch();
    uncompressed = new LZ4().decompress(compressed, 0, compressed.length, original.length);
    decompressionSW.stop();
    System.out.printf("Decompression elapsed: %f\n", decompressionSW.getElapsedSeconds());
    return new Pair<>(new Triple<>(readingSW.getElapsedSeconds(), compressionSW.getElapsedSeconds(), decompressionSW.getElapsedSeconds()), new Pair<Integer, Integer>(original.length, compressed.length));
}
Also used : SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) Pair(com.ms.silverking.collection.Pair)

Example 30 with Stopwatch

use of com.ms.silverking.time.Stopwatch in project SilverKing by Morgan-Stanley.

the class UUIDBenchmark method run.

@Override
public void run() {
    Stopwatch sw;
    int sum;
    double uuidsPerSecond;
    double usPerUUID;
    sum = 0;
    sw = new SimpleStopwatch();
    for (int i = 0; i < iterations; i++) {
        UUIDBase uuid;
        // UUID    uuid;
        // uuid = UUID.randomUUID();
        // uuid = new UUID(0, l2.getAndIncrement());
        uuid = new UUIDBase();
        sum += uuid.hashCode();
    }
    sw.stop();
    uuidsPerSecond = (double) iterations / sw.getElapsedSeconds();
    System.out.println(sum + "\n\n");
    System.out.println(uuidsPerSecond);
    usPerUUID = sw.getElapsedSeconds() / (double) (iterations * threads) * 1000000.0;
    System.out.println(usPerUUID);
}
Also used : SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch) Stopwatch(com.ms.silverking.time.Stopwatch) SimpleStopwatch(com.ms.silverking.time.SimpleStopwatch)

Aggregations

Stopwatch (com.ms.silverking.time.Stopwatch)42 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)41 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)7 IOException (java.io.IOException)5 ByteBuffer (java.nio.ByteBuffer)5 DHTSession (com.ms.silverking.cloud.dht.client.DHTSession)2 DHTKeyIntEntry (com.ms.silverking.cloud.dht.collection.DHTKeyIntEntry)2 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)2 StatSeries (com.ms.silverking.numeric.StatSeries)2 SimpleTimer (com.ms.silverking.time.SimpleTimer)2 Timer (com.ms.silverking.time.Timer)2 FileOutputStream (java.io.FileOutputStream)2 Date (java.util.Date)2 Random (java.util.Random)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 GetOptions (com.ms.silverking.cloud.dht.GetOptions)1 NamespaceOptions (com.ms.silverking.cloud.dht.NamespaceOptions)1 NamespaceVersionMode (com.ms.silverking.cloud.dht.NamespaceVersionMode)1 PutOptions (com.ms.silverking.cloud.dht.PutOptions)1 SessionOptions (com.ms.silverking.cloud.dht.SessionOptions)1