use of com.ms.silverking.time.SimpleStopwatch 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());
}
use of com.ms.silverking.time.SimpleStopwatch 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);
}
use of com.ms.silverking.time.SimpleStopwatch 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());
}
use of com.ms.silverking.time.SimpleStopwatch 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));
}
use of com.ms.silverking.time.SimpleStopwatch 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);
}
Aggregations