本文整理匯總了Java中org.openjdk.jmh.annotations.Mode.AverageTime方法的典型用法代碼示例。如果您正苦於以下問題:Java Mode.AverageTime方法的具體用法?Java Mode.AverageTime怎麽用?Java Mode.AverageTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openjdk.jmh.annotations.Mode
的用法示例。
在下文中一共展示了Mode.AverageTime方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAverage
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(1)
@OperationsPerInvocation(10000)
public void testAverage() {
Map<String, Object> data = new HashMap<String, Object>();
data.put("encryptKey", "0000000000000000");
data.put("barcode", "LH10312ACCF23C4F3A5");
Multimap<String, Rule> rules = ArrayListMultimap.create();
rules.put("barcode", Rule.required());
rules.put("barcode", Rule.regex("[0-9A-F]{16}"));
rules.put("encryptKey", Rule.required());
rules.put("encryptKey", Rule.regex("LH[0-7][0-9a-fA-F]{2}[0-5][0-4][0-9a-fA-F]{12}"));
try {
Validations.validate(data, rules);
} catch (Exception e) {
}
}
示例2: latency
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void latency() throws InvalidObjectException {
ClientOrderBuilder order = new ClientOrderBuilder();
order.setClientId(1234);
order.setAssignee("ALGO");
order.setBoardCode("MAIN");
order.setCurrencyCode("HKD");
order.setQuantity(1000);
order.setId(123456789);
order.setPrice(3.0);
order.setCreatedBy("CREATEDBY");
order.setUpdatedBy("UPDATEDBY");
order.setExchangeCode("1234");
order.setFixOrder(true);
order.setCreatedTime(System.currentTimeMillis());
order.setOrderStatus((byte) 'a');
order.setSide((byte) '1');
order.apply();
orders[(index++) % orders.length] = order;
}
示例3: stringDictionary
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public int stringDictionary() {
int length = _stringDictionary.length();
int ret = 0;
int[] dictIds = new int[NUM_ROUNDS];
for (int i = 0; i < NUM_ROUNDS; i++) {
int dictId = RANDOM.nextInt(length);
String value = _stringDictionary.getStringValue(dictId);
ret += _stringDictionary.indexOf(value);
dictIds[i] = dictId;
}
String[] outValues = new String[NUM_ROUNDS];
_stringDictionary.readStringValues(dictIds, 0, NUM_ROUNDS, outValues, 0);
for (int i = 0; i < NUM_ROUNDS; i++) {
ret += outValues[0].length();
}
return ret;
}
示例4: timeMergeAndBuildOriginalGM
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime, Mode.SingleShotTime})
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MICROSECONDS)
@Measurement(iterations = ITERATIONS_COUNT, time = 1000, timeUnit = TimeUnit.MICROSECONDS)
@Fork(1)
public Galaxy timeMergeAndBuildOriginalGM() {
dummy = ++dummy % Integer.MAX_VALUE;
Galaxy.Builder builder = Galaxy.newBuilder((Galaxy) expectedMessage);
builder.getStarBuilder(0)
.setName(String.valueOf(dummy))
.mergeFrom(mergeStar1Message)
.getPlanetBuilder(0)
.mergeFrom(mergePlanet1Message);
return builder.build();
}
示例5: measureWrong_1
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 5, time = 1)
@BenchmarkMode(Mode.AverageTime)
public List<String> measureWrong_1() {
list.add(list.size() / 2, "something");
return list;
}
示例6: measureWrong_5
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@Warmup(iterations = 5, time = 5)
@Measurement(iterations = 5, time = 5)
@BenchmarkMode(Mode.AverageTime)
public List<String> measureWrong_5() {
list.add(list.size() / 2, "something");
return list;
}
示例7: testFieldAccessReflectionApi
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
@Benchmark
public int testFieldAccessReflectionApi(FieldAccessReflectionApiState state)
throws IllegalArgumentException, IllegalAccessException {
return state.intValField.getInt(state.foo);
}
示例8: testPropertyAccessReflectionApi
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
@Benchmark
public int testPropertyAccessReflectionApi(PropertyAccessReflectionApiState state)
throws IllegalAccessException, InvocationTargetException {
return (int)state.intValAccessorMethod.invoke(state.foo);
}
示例9: none
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
* This benchmark attempts to measure the performance without any context propagation.
*
* @param blackhole a {@link Blackhole} object supplied by JMH
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork
public void none(Blackhole blackhole) throws InterruptedException {
Thread t = new Thread(new MyRunnable(blackhole));
t.start();
t.join();
}
示例10: manual
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
* This benchmark attempts to measure the performance with manual context propagation.
*
* @param blackhole a {@link Blackhole} object supplied by JMH
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork
public void manual(Blackhole blackhole) throws InterruptedException {
Thread t = new Thread((Context.current().wrap(new MyRunnable(blackhole))));
t.start();
t.join();
}
示例11: automatic
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
* This benchmark attempts to measure the performance with automatic context propagation.
*
* @param blackhole a {@link Blackhole} object supplied by JMH
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(jvmArgsAppend = "-javaagent:contrib/agent/build/libs/agent.jar")
public void automatic(Blackhole blackhole) throws InterruptedException {
Thread t = new Thread(new MyRunnable(blackhole));
t.start();
t.join();
}
示例12: none
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
* This benchmark attempts to measure the performance without any context propagation.
*
* @param blackhole a {@link Blackhole} object supplied by JMH
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork
public void none(final Blackhole blackhole) {
MoreExecutors.directExecutor().execute(new MyRunnable(blackhole));
}
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:13,代碼來源:ExecutorInstrumentationBenchmark.java
示例13: manual
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
* This benchmark attempts to measure the performance with manual context propagation.
*
* @param blackhole a {@link Blackhole} object supplied by JMH
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork
public void manual(final Blackhole blackhole) {
MoreExecutors.directExecutor().execute(Context.current().wrap(new MyRunnable(blackhole)));
}
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:13,代碼來源:ExecutorInstrumentationBenchmark.java
示例14: automatic
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
/**
* This benchmark attempts to measure the performance with automatic context propagation.
*
* @param blackhole a {@link Blackhole} object supplied by JMH
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Fork(jvmArgsAppend = "-javaagent:contrib/agent/build/libs/agent.jar")
public void automatic(final Blackhole blackhole) {
MoreExecutors.directExecutor().execute(new MyRunnable(blackhole));
}
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:13,代碼來源:ExecutorInstrumentationBenchmark.java
示例15: avg
import org.openjdk.jmh.annotations.Mode; //導入方法依賴的package包/類
@Benchmark
@Warmup(iterations = 1)
@BenchmarkMode(Mode.AverageTime)
@Measurement(iterations = 3)
public void avg() throws InterruptedException {
Thread.sleep(50);
}