Map<String, GcTimes> gcTimesBeforeSleep = getGcTimes(); while (shouldRun) { sw.reset().start(); try { Thread.sleep(SLEEP_INTERVAL_MS);
protected void testHdfsStreaming(Path filename) throws IOException { byte[] buf = new byte[1024]; FileSystem fs = filename.getFileSystem(getConf()); // read the file from start to finish Stopwatch fileOpenTimer = Stopwatch.createUnstarted(); Stopwatch streamTimer = Stopwatch.createUnstarted(); fileOpenTimer.start(); FSDataInputStream in = fs.open(filename); fileOpenTimer.stop(); long totalBytes = 0; streamTimer.start(); while (true) { int read = in.read(buf); if (read < 0) { break; } totalBytes += read; } streamTimer.stop(); double throughput = (double)totalBytes / streamTimer.elapsed(TimeUnit.SECONDS); System.out.println("HDFS streaming: "); System.out.println("total time to open: " + fileOpenTimer.elapsed(TimeUnit.MILLISECONDS) + " ms"); System.out.println("total time to read: " + streamTimer.elapsed(TimeUnit.MILLISECONDS) + " ms"); System.out.println("total bytes: " + totalBytes + " bytes (" + StringUtils.humanReadableInt(totalBytes) + ")"); System.out.println("throghput : " + StringUtils.humanReadableInt((long)throughput) + "B/s"); }
@Override protected int doWork() throws Exception { generateRegionsAndServers(); String methodName = "roundRobinAssignment"; LOG.info("Calling " + methodName); Stopwatch watch = Stopwatch.createStarted(); loadBalancer.roundRobinAssignment(regions, servers); System.out.print(formatResults(methodName, watch.elapsed(TimeUnit.MILLISECONDS))); methodName = "retainAssignment"; LOG.info("Calling " + methodName); watch.reset().start(); loadBalancer.retainAssignment(regionServerMap, servers); System.out.print(formatResults(methodName, watch.elapsed(TimeUnit.MILLISECONDS))); methodName = "balanceCluster"; LOG.info("Calling " + methodName); watch.reset().start(); loadBalancer.balanceCluster(serverRegionMap); System.out.print(formatResults(methodName, watch.elapsed(TimeUnit.MILLISECONDS))); return EXIT_SUCCESS; }
snapshotRestoreTimer.start(); restoreDir.getFileSystem(conf).delete(restoreDir, true); snapshotRestoreTimer.stop(); scanOpenTimer.start(); TableSnapshotScanner scanner = new TableSnapshotScanner(conf, restoreDir, snapshotName, scan); scanOpenTimer.stop(); scanTimer.start(); while (true) { Result result = scanner.next();
job.setOutputFormatClass(NullOutputFormat.class); scanTimer.start(); job.waitForCompletion(true); scanTimer.stop();
job.setOutputFormatClass(NullOutputFormat.class); scanTimer.start(); job.waitForCompletion(true); scanTimer.stop();
Stopwatch scanTimer = Stopwatch.createUnstarted(); tableOpenTimer.start(); Connection connection = ConnectionFactory.createConnection(getConf()); Table table = connection.getTable(TableName.valueOf(tablename)); scanOpenTimer.start(); ResultScanner scanner = table.getScanner(scan); scanOpenTimer.stop(); scanTimer.start(); while (true) { Result result = scanner.next();
/** * Creates (and starts) a new stopwatch using {@link System#nanoTime} as its time source. * * @since 15.0 */ public static Stopwatch createStarted() { return new Stopwatch().start(); }
/** * Creates (and starts) a new stopwatch, using the specified time source. * * @since 15.0 */ public static Stopwatch createStarted(Ticker ticker) { return new Stopwatch(ticker).start(); }
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> function) { stopwatch.start(); V previousValue; try { previousValue = oldValue.waitForValue(); } catch (ExecutionException e) { previousValue = null; } V newValue = function.apply(key, previousValue); this.set(newValue); return newValue; }
public ListenableFuture<V> loadFuture(K key, CacheLoader<? super K, V> loader) { try { stopwatch.start(); V previousValue = oldValue.get(); if (previousValue == null) {
@Override protected int doWork() throws Exception { generateRegionsAndServers(); String methodName = "roundRobinAssignment"; LOG.info("Calling " + methodName); Stopwatch watch = Stopwatch.createStarted(); loadBalancer.roundRobinAssignment(regions, servers); System.out.print(formatResults(methodName, watch.elapsed(TimeUnit.MILLISECONDS))); methodName = "retainAssignment"; LOG.info("Calling " + methodName); watch.reset().start(); loadBalancer.retainAssignment(regionServerMap, servers); System.out.print(formatResults(methodName, watch.elapsed(TimeUnit.MILLISECONDS))); methodName = "balanceCluster"; LOG.info("Calling " + methodName); watch.reset().start(); loadBalancer.balanceCluster(serverRegionMap); System.out.print(formatResults(methodName, watch.elapsed(TimeUnit.MILLISECONDS))); return EXIT_SUCCESS; }
protected void testHdfsStreaming(Path filename) throws IOException { byte[] buf = new byte[1024]; FileSystem fs = filename.getFileSystem(getConf()); // read the file from start to finish Stopwatch fileOpenTimer = Stopwatch.createUnstarted(); Stopwatch streamTimer = Stopwatch.createUnstarted(); fileOpenTimer.start(); FSDataInputStream in = fs.open(filename); fileOpenTimer.stop(); long totalBytes = 0; streamTimer.start(); while (true) { int read = in.read(buf); if (read < 0) { break; } totalBytes += read; } streamTimer.stop(); double throughput = (double)totalBytes / streamTimer.elapsed(TimeUnit.SECONDS); System.out.println("HDFS streaming: "); System.out.println("total time to open: " + fileOpenTimer.elapsed(TimeUnit.MILLISECONDS) + " ms"); System.out.println("total time to read: " + streamTimer.elapsed(TimeUnit.MILLISECONDS) + " ms"); System.out.println("total bytes: " + totalBytes + " bytes (" + StringUtils.humanReadableInt(totalBytes) + ")"); System.out.println("throghput : " + StringUtils.humanReadableInt((long)throughput) + "B/s"); }
protected void testHdfsStreaming(Path filename) throws IOException { byte[] buf = new byte[1024]; FileSystem fs = filename.getFileSystem(getConf()); // read the file from start to finish Stopwatch fileOpenTimer = Stopwatch.createUnstarted(); Stopwatch streamTimer = Stopwatch.createUnstarted(); fileOpenTimer.start(); FSDataInputStream in = fs.open(filename); fileOpenTimer.stop(); long totalBytes = 0; streamTimer.start(); while (true) { int read = in.read(buf); if (read < 0) { break; } totalBytes += read; } streamTimer.stop(); double throughput = (double)totalBytes / streamTimer.elapsed(TimeUnit.SECONDS); System.out.println("HDFS streaming: "); System.out.println("total time to open: " + fileOpenTimer.elapsed(TimeUnit.MILLISECONDS) + " ms"); System.out.println("total time to read: " + streamTimer.elapsed(TimeUnit.MILLISECONDS) + " ms"); System.out.println("total bytes: " + totalBytes + " bytes (" + StringUtils.humanReadableInt(totalBytes) + ")"); System.out.println("throghput : " + StringUtils.humanReadableInt((long)throughput) + "B/s"); }
snapshotRestoreTimer.start(); restoreDir.getFileSystem(conf).delete(restoreDir, true); snapshotRestoreTimer.stop(); scanOpenTimer.start(); TableSnapshotScanner scanner = new TableSnapshotScanner(conf, restoreDir, snapshotName, scan); scanOpenTimer.stop(); scanTimer.start(); while (true) { Result result = scanner.next();
snapshotRestoreTimer.start(); restoreDir.getFileSystem(conf).delete(restoreDir, true); snapshotRestoreTimer.stop(); scanOpenTimer.start(); TableSnapshotScanner scanner = new TableSnapshotScanner(conf, restoreDir, snapshotName, scan); scanOpenTimer.stop(); scanTimer.start(); while (true) { Result result = scanner.next();
job.setOutputFormatClass(NullOutputFormat.class); scanTimer.start(); job.waitForCompletion(true); scanTimer.stop();
job.setOutputFormatClass(NullOutputFormat.class); scanTimer.start(); job.waitForCompletion(true); scanTimer.stop();