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


Java OutputTimeUnit类代码示例

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


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

示例1: testApi

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

示例2: testAverage

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

示例3: latency

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

示例4: testUnfairLockContended

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

示例5: testFairLockContended

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

示例6: timeMergeAndBuild

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

示例7: timeMergeAndBuildOriginalGM

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的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();    
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:19,代码来源:BuilderBenchmark.java

示例8: stringDictionary

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的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;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:21,代码来源:BenchmarkOfflineIndexReader.java

示例9: testCascadedValidation

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Fork(value = 1)
@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 20)
public void testCascadedValidation(ParsingBeansSpeedState state, Blackhole bh) {
	// Validator in new factory

	for ( Object o : state.holder.beans ) {
		bh.consume( state.validator.getConstraintsForClass( o.getClass() ).isBeanConstrained() );
	}
}
 
开发者ID:hibernate,项目名称:beanvalidation-benchmark,代码行数:15,代码来源:ParsingBeansSpeedBenchmark.java

示例10: testCascadedValidation

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@Threads(50)
@Warmup(iterations = 20) // it seems that as there are a lot of beans it takes some time to warmup
@Measurement(iterations = 30)
public void testCascadedValidation(RawValidationSpeedState state, Blackhole bh) {
	for ( Object o : state.holder.beans ) {
		Set<ConstraintViolation<Object>> constraintViolations = state.validator.validate( o );
		bh.consume( constraintViolations );
	}
}
 
开发者ID:hibernate,项目名称:beanvalidation-benchmark,代码行数:14,代码来源:RawValidationSpeedBenchmark.java

示例11: testFieldAccessReflectionApi

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
@Benchmark
public int testFieldAccessReflectionApi(FieldAccessReflectionApiState state)
		throws IllegalArgumentException, IllegalAccessException {
	return state.intValField.getInt(state.foo);
}
 
开发者ID:Javalbert,项目名称:faster-than-reflection,代码行数:8,代码来源:FasterThanReflectionBenchmark.java

示例12: testPropertyAccessReflectionApi

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@BenchmarkMode(Mode.AverageTime)
@Benchmark
public int testPropertyAccessReflectionApi(PropertyAccessReflectionApiState state)
		throws IllegalAccessException, InvocationTargetException {
	return (int)state.intValAccessorMethod.invoke(state.foo);
}
 
开发者ID:Javalbert,项目名称:faster-than-reflection,代码行数:8,代码来源:FasterThanReflectionBenchmark.java

示例13: testSingleSearch

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public List<String> testSingleSearch(Data data, Iterator i) {
	String query = null;
	while(query == null) {
		query = i.getNextQuery(data.queries);
	}
	return data.wordSearch.findSimilarWords(query);
}
 
开发者ID:searchhub,项目名称:preDict,代码行数:11,代码来源:LuceneBenchmark.java

示例14: measureSimpleClientSummaryThroughput

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientSummaryThroughput() {
  promSummary = io.prometheus.client.Summary.build().name("name").help("help").create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    promSummary.observe(i);
  }
}
 
开发者ID:outbrain,项目名称:prometheus-client,代码行数:10,代码来源:SummaryThroughputTest.java

示例15: measureSimpleClientSummaryThroughputWithLabels

import org.openjdk.jmh.annotations.OutputTimeUnit; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public void measureSimpleClientSummaryThroughputWithLabels() {
  promSummary = io.prometheus.client.Summary.build().name("name").help("help").labelNames(LABEL_NAMES).create();
  for (int i = 0; i < NUM_OF_ITERATIONS; i++) {
    promSummary.labels(LABEL_VALUES.get(i % LABEL_VALUES.size())).observe(i);
  }
}
 
开发者ID:outbrain,项目名称:prometheus-client,代码行数:10,代码来源:SummaryThroughputTest.java


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