当前位置: 首页>>代码示例>>Java>>正文


Java Mode类代码示例

本文整理汇总了Java中org.openjdk.jmh.annotations.Mode的典型用法代码示例。如果您正苦于以下问题:Java Mode类的具体用法?Java Mode怎么用?Java Mode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Mode类属于org.openjdk.jmh.annotations包,在下文中一共展示了Mode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCompareQuery

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Test
public void testCompareQuery() throws SQLException, RunnerException {
    Options options = new OptionsBuilder()
        .include(getClass().getName() + ".*")
        .mode(Mode.SingleShotTime)
        .timeUnit(TimeUnit.MILLISECONDS)
        .warmupTime(TimeValue.seconds(5))
        .warmupIterations(2)
        .measurementTime(TimeValue.seconds(10))
        .measurementIterations(5)
        .threads(1)
        .forks(2)
        .build();
    try {
        new Runner(options).run();
    } catch (NoBenchmarksException ignored) {
        // expected? only happens from gradle
    }
}
 
开发者ID:requery,项目名称:requery,代码行数:20,代码来源:BenchmarkTest.java

示例2: loadPaths

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@BeforeAll
static void loadPaths() throws IOException, RunnerException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
	String[] paths;
	fileSystem = FileTestHelper.createMockFileSystem(Configuration.unix());
	fileSystemField = ConversionEntry.class.getDeclaredField("fileSystem");
	fileSystemField.setAccessible(true);
	defaultFileSystem = (FileSystem) fileSystemField.get(null);
	fileSystemField.set(null, fileSystem);
	paths = FileTestHelper.getAllQrdaFiles(fileSystem, "-latest.xml").map(Path::toString).toArray(String[]::new);

	Options opt = new OptionsBuilder()
			.mode(Mode.Throughput)
			.mode(Mode.AverageTime)
			.include(".*" + ParameterizedBenchmark.class.getSimpleName() + ".*")
			.param("fileName", paths)
			.forks(1)
			.build();

	List<RunResult> results = new ArrayList<>(new Runner(opt).run());
	benchResults = results.stream()
			.map(RunResult::getAggregatedResult)
			.collect(Collectors.toList());
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:24,代码来源:ParameterizedBenchmarkTest.java

示例3: run

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Test
public void run() throws Exception {
    //Add more iterations, forks, etc, results should be similar or better.  At least they
    //were on my machine.
    Options opt = new OptionsBuilder()
            .include(this.getClass().getName() + ".*")
            //.mode(Mode.Throughput)
            .mode(Mode.AverageTime)
            .timeUnit(TimeUnit.MICROSECONDS)
            .warmupIterations(5)
            .measurementIterations(5)
            .forks(1)
            .threads(10)
            .shouldDoGC(true)
            .jvmArgs("")
            .build();
    new Runner(opt).run();
}
 
开发者ID:a-hansen,项目名称:alog,代码行数:19,代码来源:AlogBenchmark.java

示例4: sendAsyncMessage

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
/**
 * 发送异步消息
 * @throws InterruptedException
 * @throws RemotingException
 * @throws MQClientException
 * @throws MQBrokerException
 */
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void sendAsyncMessage() throws InterruptedException, RemotingException, MQClientException, MQBrokerException {
    producer.send(new Message(RocketMQConfiguration.ROCKETMQ_TOPIC,message), new SendCallback() {
        @Override
        public void onSuccess(SendResult sendResult) {
            //System.out.println("receive message"+sendResult);
        }

        @Override
        public void onException(Throwable throwable) {
            //System.out.println("receive message error"+throwable.getLocalizedMessage());
        }
    });
}
 
开发者ID:mumudemo,项目名称:mumu-rocketmq,代码行数:23,代码来源:RocketMQAsyncMessage.java

示例5: main

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
    for (int threads = 1; threads < 32; threads <<= 1) {
        Options opt = new OptionsBuilder()
                .forks(10)
                .threads(threads)
                .warmupIterations(10)
                .measurementIterations(20)
                .mode(Mode.AverageTime)
                .timeUnit(TimeUnit.NANOSECONDS)
                .include("ky.korins.atomic.benchmark")
                .resultFormat(ResultFormatType.CSV)
                .result("atomic_" + threads + ".csv")
                .build();

        new Runner(opt).run();
    }
}
 
开发者ID:catap,项目名称:atomic,代码行数:18,代码来源:Driver.java

示例6: testApi

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Fork(1)
@OperationsPerInvocation(10000)
public void testApi() {
  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) {
  }

}
 
开发者ID:edgar615,项目名称:direwolves,代码行数:23,代码来源:ValidationBenchmarks.java

示例7: 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) {
  }
}
 
开发者ID:edgar615,项目名称:direwolves,代码行数:22,代码来源:ValidationBenchmarks.java

示例8: 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;
}
 
开发者ID:maxns,项目名称:deltaforce,代码行数:24,代码来源:ClientOrderBenchmark.java

示例9: main

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
    if(args.length != 1 || args[0] == null || args[0].isEmpty()) {
        System.exit(1);
    }
    String testName = args[0];

    Options opt = addTestToOptionsBuilder(new OptionsBuilder(), testName)
            .forks(NO_FORKS_RUN_ON_THE_SAME_JVM)
            // We need to avoid warmup iterations as they however counts towards total Postgres time
            .warmupIterations(0)
            .measurementIterations(ITERATIONS)
            .timeUnit(TimeUnit.MILLISECONDS)
            .mode(Mode.SingleShotTime)
            .verbosity(VerboseMode.SILENT)
            .build();

    Collection<RunResult> runResults = new Runner(opt).run();

    runResults.stream().forEach(runResult ->
        System.out.printf(
                "Java:\t%s\t%.2f\n",
                runResult.getParams().getBenchmark(),
                runResult.getPrimaryResult().getScore()
        )
    );
}
 
开发者ID:8kdata,项目名称:javapgperf,代码行数:27,代码来源:Main.java

示例10: pushWithoutJit

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Benchmark
@CompilerControl(org.openjdk.jmh.annotations.CompilerControl.Mode.EXCLUDE)
public long pushWithoutJit() {
    Reader reader = new Reader(MAX, _nulls);
    PushConsumer consumer = new PushConsumer();
    for (int i = 0; i < reader.getMax(); i++) {
        boolean nextIsNull = reader.nextIsNull();
        if (nextIsNull) {
            consumer.consumeNull();
        } else {
            consumer.consume(reader.readNext());
        }
    }
    assertThat(consumer.getSum()).isEqualTo(4950000000000000L);
    assertThat(consumer.getNullCount()).isEqualTo(1000000);
    return consumer.getSum();
}
 
开发者ID:jzillmann,项目名称:gradle-jmh-report,代码行数:18,代码来源:PullPushBenchmark.java

示例11: testUnfairLockContended

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Benchmark
@BenchmarkMode({   Mode.Throughput})
  @OutputTimeUnit
    (TimeUnit.MILLISECONDS)
public long testUnfairLockContended(Contended contended )
{
	contended.unfairLock.lock();
	try{
		return execute();
	}
	finally
	{
		contended.unfairLock.unlock();
	}
	
	
	
}
 
开发者ID:ThomasKrieger,项目名称:benchmarks,代码行数:19,代码来源:ReentrantLockBenchmark.java

示例12: testFairLockContended

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Benchmark
@BenchmarkMode({   Mode.Throughput})
  @OutputTimeUnit
    (TimeUnit.MILLISECONDS)
public long testFairLockContended(Contended contended)
{
	contended.fairLock.lock();
	try{
		return execute();
	}
	finally
	{
		contended.fairLock.unlock();
	}
	
	
	
}
 
开发者ID:ThomasKrieger,项目名称:benchmarks,代码行数:19,代码来源:ReentrantLockBenchmark.java

示例13: testWithGMP

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void testWithGMP(PaillierBenchmarkState allState)
{
  SystemConfiguration.setProperty("paillier.useGMPForModPow", "true");
  SystemConfiguration.setProperty("paillier.GMPConstantTimeMode", "false");
  ModPowAbstraction.reloadConfiguration();

  try
  {
    allState.pallier.encrypt(allState.m1, allState.r1);
  } catch (PIRException e)
  {
    logger.info("Exception in testWithGMP!\n");
  }
}
 
开发者ID:apache,项目名称:incubator-pirk,代码行数:17,代码来源:PaillierBenchmark.java

示例14: testWithGMPConstantTime

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void testWithGMPConstantTime(PaillierBenchmarkState allState)
{
  SystemConfiguration.setProperty("paillier.useGMPForModPow", "true");
  SystemConfiguration.setProperty("paillier.GMPConstantTimeMode", "true");
  ModPowAbstraction.reloadConfiguration();

  try
  {
    allState.pallier.encrypt(allState.m1, allState.r1);
  } catch (PIRException e)
  {
    logger.info("Exception in testWithGMPConstantTime!\n");
  }
}
 
开发者ID:apache,项目名称:incubator-pirk,代码行数:17,代码来源:PaillierBenchmark.java

示例15: startAllBenchmarks

import org.openjdk.jmh.annotations.Mode; //导入依赖的package包/类
@Test
public void startAllBenchmarks() throws Exception {
    ChainedOptionsBuilder opts = new OptionsBuilder()
                                        .mode(Mode.SampleTime)
                                        .timeUnit(TimeUnit.NANOSECONDS)
                                        .warmupTime(TimeValue.seconds(1))
                                        .warmupIterations(8)
                                        .measurementTime(TimeValue.seconds(1))
                                        .measurementIterations(5)
                                        .timeout(TimeValue.seconds(30))
                                        .threads(2)
                                        .forks(1) //0 for debug, 1 for run
                                        .shouldFailOnError(true)
                                        .shouldDoGC(true) //because of graph
                                        .addProfiler(profilers.FlightRecordingProfiler.class);

    new Runner(opts.include(getClass().getSimpleName() + ".*").build()).run();
}
 
开发者ID:DataArt,项目名称:CalculationEngine,代码行数:19,代码来源:BenchmarkTestParent.java


注:本文中的org.openjdk.jmh.annotations.Mode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。