public HankTimer getTimer() { if (!isActive) { return null; } return new HankTimer(); }
private static void createZeroFile(String path, long numRecords, int bufferSize) throws IOException { FileOutputStream zeroFile = new FileOutputStream(path); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(zeroFile, bufferSize); byte[] record = new byte[KEY_HASH_SIZE + VALUE_SIZE]; HankTimer timer = new HankTimer(); for (int i = 0; i < numRecords; ++i) { bufferedOutputStream.write(record); } bufferedOutputStream.close(); zeroFile.close(); double elapsedSecs = timer.getDurationMs() / 1000.0; long totalBytes = numRecords * record.length; System.out.println("Throughput to write zero file of size " + FormatUtils.formatNumBytes(totalBytes) + " with buffer of " + FormatUtils.formatNumBytes(bufferSize) + ": " + FormatUtils.formatDataThroughput(totalBytes / elapsedSecs)); }
private void warmUp() throws IOException { LOG.info("Warming up data server..."); List<Thread> threads = new ArrayList<Thread>(); for (int i = 0; i < configurator.getNumConcurrentQueries(); ++i) { threads.add(new Thread(new WarmupRunnable(), "Warmup Thread #" + i)); } HankTimer timer = new HankTimer(); for (Thread thread : threads) { thread.start(); } for (Thread thread : threads) { try { thread.join(); } catch (InterruptedException e) { LOG.error("Failed to warm up data server", e); throw new IOException("Failed to warm up data server", e); } } long warmupDurationMs = timer.getDurationMs(); LOG.info("Warming up data server took " + warmupDurationMs + " ms"); }
@Override public void update() throws IOException { HankTimer timer = new HankTimer(); try {
private static void doTestPerformanceCueballMerger(String localTmpDir, DomainVersion baseVersion, DomainVersion deltaVersion, DomainVersion newBaseVersion) throws IOException { HankTimer timer = new HankTimer(); new CueballMerger().merge( new CueballFilePath(localTmpDir + "/0/" + Cueball.getName(baseVersion)), Collections.singletonList(new CueballFilePath(localTmpDir + "/0/" + Cueball.getName(deltaVersion))), localTmpDir + "/" + Cueball.getName(newBaseVersion), KEY_HASH_SIZE, VALUE_SIZE, null, HASH_INDEX_BITS, new NoCueballCompressionCodec()); double elapsedS = timer.getDurationMs() / 1000.0; System.out.println("Merge done in " + elapsedS + " seconds"); }
HankTimer timer = new HankTimer(); long[] offsetAdjustments = curlyMerger.merge(newCurlyBasePath, curlyDeltaRemoteFiles, partitionRemoteFileOps); long curlyTimeMs = timer.getDurationMs();
public static void testPerformanceCueballWriter(String localTmpDir) throws IOException { // Fill in all indexable blocks long numRecords = getNumTotalRecords(); Writer writer = getCueball(localTmpDir).getWriter( new MockDomainVersion(0, 0L, new IncrementalDomainVersionProperties.Base()), new LocalPartitionRemoteFileOps(localTmpDir, 0), 0); HankTimer timer = new HankTimer(); for (long i = 0; i < numRecords; ++i) { writer.write(key(i, KEY_SIZE), value(i, VALUE_SIZE)); } writer.close(); double elapsedMs = timer.getDurationMs(); double elapsedSecs = elapsedMs / 1000.0; long totalBytes = numRecords * (KEY_HASH_SIZE + VALUE_SIZE); System.out.println("Test took " + elapsedMs + "ms, wrote " + numRecords + " records totalling " + FormatUtils.formatNumBytes(totalBytes)); System.out.println(String.format("Throughput: %.2f writes/sec", numRecords / elapsedSecs)); System.out.println("Throughput: " + FormatUtils.formatDataThroughput(totalBytes / elapsedSecs)); createZeroFile(localTmpDir + "/zero_file0", numRecords, IOStreamUtils.DEFAULT_BUFFER_SIZE); createZeroFile(localTmpDir + "/zero_file1", numRecords, 10 << 20); }
HankTimer timer = new HankTimer();
HankTimer timer = new HankTimer(); cacheVersionsNeededToUpdate(currentVersion, cachedBases, cachedDeltas, updatePlan); long fetchTimeMs = timer.getDurationMs();
cueballStreamBufferMergeSortFactory.getInstance(cueballBasePath, cueballDeltas); HankTimer timer = new HankTimer(); merger.merge(curlyBasePath, curlyDeltas, cueballStreamBufferMergeSort, curlyReaderFactory, writer); statistics.getDurationsMs().put("Curly compaction", timer.getDurationMs());