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


Java BenchmarkMode类代码示例

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


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

示例1: sendAsyncMessage

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例2: testApi

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例3: testAverage

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例4: latency

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例5: testUnfairLockContended

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例6: testFairLockContended

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例7: testWithGMP

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例8: testWithGMPConstantTime

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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

示例9: benchmark

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void benchmark(final AdditionalCounters counters) throws Exception {
    JsonRequest<Ping> request = new JsonRequest.Builder<Ping>("ping-server", "ping")
        .setBody(new Ping("ping?"))
        .setTimeout(20000)
        .setRetryLimit(0)
        .build();

    TFuture<JsonResponse<Pong>> future = this.subClient.send(request);
    future.addCallback(new TFutureCallback<JsonResponse<Pong>>() {
        @Override
        public void onResponse(JsonResponse<Pong> pongResponse) {
            if (!pongResponse.isError()) {
                counters.actualQPS.incrementAndGet();
            } else {
                counters.errorQPS.incrementAndGet();
            }
        }
    });
}
 
开发者ID:uber,项目名称:tchannel-java,代码行数:22,代码来源:PingPongMultiServerBenchmark.java

示例10: timeMergeAndBuild

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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 Message timeMergeAndBuild() {
  dummy = ++dummy % Integer.MAX_VALUE;
  
  Builder builder = newBuilder(expectedMessage)
      .getFieldBuilder(galaxyStar, 0)
          .setField(starName, String.valueOf(dummy))
          .mergeFrom(mergeStar1Message)
          .getFieldBuilder(starPlanet, 0)
              .mergeFrom(mergePlanet1Message)
              .toParent()
          .toParent();
  
  return builder.build();
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:21,代码来源:BuilderBenchmark.java

示例11: generateImport

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的package包/类
private void generateImport(PrintWriter writer) {
    Class<?>[] imports = new Class<?>[]{
            List.class, AtomicInteger.class,
            Collection.class, ArrayList.class,
            TimeUnit.class, Generated.class, CompilerControl.class,
            InfraControl.class, ThreadParams.class,
            Result.class, ThroughputResult.class, AverageTimeResult.class,
            SampleTimeResult.class, SingleShotResult.class, SampleBuffer.class,
            Mode.class, Fork.class, Measurement.class, Threads.class, Warmup.class,
            BenchmarkMode.class, RawResults.class, ResultRole.class,
            Field.class, BenchmarkParams.class, IterationParams.class
    };

    for (Class<?> c : imports) {
        writer.println("import " + c.getName() + ';');
    }
    writer.println();
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:19,代码来源:BenchmarkGenerator.java

示例12: sendMessage

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的package包/类
/**
 * 发送同步消息
 * @throws InterruptedException
 * @throws RemotingException
 * @throws MQClientException
 * @throws MQBrokerException
 */
@Benchmark
@BenchmarkMode(Mode.Throughput)
public void sendMessage(){
    try {
        SendResult sendResult = producer.send(new Message(RocketMQConfiguration.ROCKETMQ_TOPIC, message));
    } catch (Exception e) {
        //e.printStackTrace();
    }
}
 
开发者ID:mumudemo,项目名称:mumu-rocketmq,代码行数:17,代码来源:RocketMQSyncMessage.java

示例13: measureWrong_1

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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;
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:9,代码来源:JMHSample_26_BatchSize.java

示例14: measureWrong_5

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的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;
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:9,代码来源:JMHSample_26_BatchSize.java

示例15: measureRight

import org.openjdk.jmh.annotations.BenchmarkMode; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 5, batchSize = 5000)
@Measurement(iterations = 5, batchSize = 5000)
@BenchmarkMode(Mode.SingleShotTime)
public List<String> measureRight() {
    list.add(list.size() / 2, "something");
    return list;
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:9,代码来源:JMHSample_26_BatchSize.java


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