public void add(HankTimer timer, int underlyingCount) { if (!isActive) { return; } _add(timer.getStartTime(), timer.getDuration(), underlyingCount); }
public HankTimer getTimer() { if (!isActive) { return null; } return new HankTimer(); }
@Override public void transform(byte[] buf, int valueOff, int relIndex) { long adjustment = offsetAdjustments[relIndex]; if (adjustment != 0) { long offset = EncodingHelper.decodeLittleEndianFixedWidthLong(buf, valueOff, offsetNumBytes); offset += adjustment; EncodingHelper.encodeLittleEndianFixedWidthLong(offset, buf, valueOff, offsetNumBytes); } } }
public PartitionAccessor(HostDomainPartition partition, Reader reader) { if (reader == null) { throw new IllegalArgumentException("Reader may not be null!"); } this.partition = partition; this.reader = reader; windowTimer.restart(); countersWindow = new AtomicLongCollection(5, new long[]{0, 0, 0, 0, 0}); }
@Override public CacheStatistics getCacheStatistics() { return new CacheStatistics( cache.size(), cache.getMaxNumItems(), cache.getNumManagedBytes(), cache.getMaxNumManagedBytes()); }
public static void main(String[] args) throws IOException, InvalidConfigurationException, InterruptedException, KeeperException { CommandLineChecker.check(args, new String[]{"configuration"}, MigrationHelper.class); String configurationPath = args[0]; Coordinator coordinator = new YamlCoordinatorConfigurator(configurationPath).createCoordinator(); } }
public static void encodeLittleEndianFixedWidthLong(long l, byte[] array) { encodeLittleEndianFixedWidthLong(l, array, 0, array.length); }
public static long copy(final InputStream input, final OutputStream output) throws IOException { byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; return copy(input, output, buffer); }
public long getDurationMs() { return getDuration() / 1000000; } }
public void add(HankTimer timer) { add(timer, 1); }
public int size() { if (!isEnabled()) { return 0; } else { synchronized (cache) { return cache.size(); } } }
public AtomicLongCollection(int size, long[] initialValues) { values = new long[size]; set(initialValues); }
public V get(K key) { if (!isEnabled()) { return null; } else { synchronized (cache) { return cache.get(key); } } }
public void dropDecompressionOutputStream() { decompressionOutputStream = new UnsafeByteArrayOutputStream(); } }
public DurationAggregator(String name) { this.name = name; this.clear(); }
public void clear() { decompressionOutputStream.reset(); }
public RandomReadsRunnable(File[] testFiles, int randomReadBufferSize) throws FileNotFoundException { // Open file channels testChannels = new FileChannel[testFiles.length]; for (int i = 0; i < testFiles.length; ++i) { testChannels[i] = new FileInputStream(testFiles[i]).getChannel(); } timerAggregator = new HankTimerEventAggregator("Random reads", 1); this.randomReadBufferSize = randomReadBufferSize; }
private boolean loadValueFromCache(ByteBuffer location, ReaderResult result) { ByteBuffer value = cache.get(location); if (value != null) { result.deepCopyIntoResultBuffer(value); result.found(); result.setL2CacheHit(true); return true; } else { return false; } }
synchronized public long[] getAsArrayAndSet(long... newValues) { long[] result = new long[values.length]; System.arraycopy(values, 0, result, 0, values.length); set(newValues); return result; }
public int getMaxNumItems() { if(!isEnabled()){ return 0; }else{ return cache.getMaxNumItems(); } }