Example usage for java.util.concurrent TimeUnit MICROSECONDS

List of usage examples for java.util.concurrent TimeUnit MICROSECONDS

Introduction

In this page you can find the example usage for java.util.concurrent TimeUnit MICROSECONDS.

Prototype

TimeUnit MICROSECONDS

To view the source code for java.util.concurrent TimeUnit MICROSECONDS.

Click Source Link

Document

Time unit representing one thousandth of a millisecond.

Usage

From source file:org.apache.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)/*  ww  w .j a  v  a 2 s.c  o  m*/
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexLongTwice(Blackhole blackhole) {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:io.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)//from  w  w w.j a v  a2 s.c om
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexLongTwice(Blackhole blackhole) throws Exception {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:org.apache.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)//from ww  w .  java 2  s. c  o  m
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexFloatTwice(Blackhole blackhole) {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:com.netflix.dyno.jedis.DynoJedisPipeline.java

@Override
public Response<String> get(final String key) {
    if (CompressionStrategy.NONE == connPool.getConfiguration().getCompressionStrategy()) {
        return new PipelineOperation<String>() {
            @Override/*from w w w  .j  av a  2 s.c o  m*/
            Response<String> execute(Pipeline jedisPipeline) throws DynoException {
                long startTime = System.nanoTime() / 1000;
                try {
                    return jedisPipeline.get(key);
                } finally {
                    long duration = System.nanoTime() / 1000 - startTime;
                    opMonitor.recordSendLatency(OpName.GET.name(), duration, TimeUnit.MICROSECONDS);
                }
            }
        }.execute(key, OpName.GET);
    } else {
        return new PipelineCompressionOperation<String>() {
            @Override
            Response<String> execute(final Pipeline jedisPipeline) throws DynoException {
                return new PipelineResponse(null).apply(new Func0<Response<String>>() {
                    @Override
                    public Response<String> call() {
                        return jedisPipeline.get(key);
                    }
                });
            }
        }.execute(key, OpName.GET);
    }

}

From source file:org.apache.distributedlog.BKLogHandler.java

/**
 * Add the segment <i>metadata</i> for <i>name</i> in the cache.
 *
 * @param name/*from  ww  w .  j  a v  a 2 s. c om*/
 *          segment znode name.
 * @param metadata
 *          segment metadata.
 */
protected void addLogSegmentToCache(String name, LogSegmentMetadata metadata) {
    metadataCache.put(metadata.getZkPath(), metadata);
    logSegmentCache.add(name, metadata);
    // update the last ledger rolling time
    if (!metadata.isInProgress() && (lastLedgerRollingTimeMillis < metadata.getCompletionTime())) {
        lastLedgerRollingTimeMillis = metadata.getCompletionTime();
    }

    if (reportGetSegmentStats) {
        // update stats
        long ts = System.currentTimeMillis();
        if (metadata.isInProgress()) {
            // as we used timestamp as start tx id we could take it as start time
            // NOTE: it is a hack here.
            long elapsedMillis = ts - metadata.getFirstTxId();
            long elapsedMicroSec = TimeUnit.MILLISECONDS.toMicros(elapsedMillis);
            if (elapsedMicroSec > 0) {
                if (elapsedMillis > metadataLatencyWarnThresholdMillis) {
                    LOG.warn("{} received inprogress log segment in {} millis: {}",
                            new Object[] { getFullyQualifiedName(), elapsedMillis, metadata });
                }
                getInprogressSegmentStat.registerSuccessfulEvent(elapsedMicroSec, TimeUnit.MICROSECONDS);
            } else {
                negativeGetInprogressSegmentStat.registerSuccessfulEvent(-elapsedMicroSec,
                        TimeUnit.MICROSECONDS);
            }
        } else {
            long elapsedMillis = ts - metadata.getCompletionTime();
            long elapsedMicroSec = TimeUnit.MILLISECONDS.toMicros(elapsedMillis);
            if (elapsedMicroSec > 0) {
                if (elapsedMillis > metadataLatencyWarnThresholdMillis) {
                    LOG.warn("{} received completed log segment in {} millis : {}",
                            new Object[] { getFullyQualifiedName(), elapsedMillis, metadata });
                }
                getCompletedSegmentStat.registerSuccessfulEvent(elapsedMicroSec, TimeUnit.MICROSECONDS);
            } else {
                negativeGetCompletedSegmentStat.registerSuccessfulEvent(-elapsedMicroSec,
                        TimeUnit.MICROSECONDS);
            }
        }
    }
}

From source file:io.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)/*from w w  w  . jav a2s. c om*/
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexFloatTwice(Blackhole blackhole) throws Exception {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:org.apache.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)//from  w w  w.  j a  v a2  s . c  o m
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexFloatThenLong(Blackhole blackhole) {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:io.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)/*from w  w  w  .jav a  2 s  .com*/
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexFloatThenLong(Blackhole blackhole) throws Exception {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, longQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:org.apache.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)//from  w  w  w.  j  a  va2 s.  com
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexFloatThenString(Blackhole blackhole) {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, stringQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}

From source file:io.druid.benchmark.GroupByTypeInterfaceBenchmark.java

@Benchmark
@BenchmarkMode(Mode.AverageTime)/*from  ww  w.ja  v a2 s  .  c o m*/
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void querySingleQueryableIndexFloatThenString(Blackhole blackhole) throws Exception {
    QueryRunner<Row> runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    List<Row> results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, floatQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }

    runner = QueryBenchmarkUtil.makeQueryRunner(factory, "qIndex",
            new QueryableIndexSegment("qIndex", queryableIndexes.get(0)));

    results = GroupByTypeInterfaceBenchmark.runQuery(factory, runner, stringQuery);

    for (Row result : results) {
        blackhole.consume(result);
    }
}