當前位置: 首頁>>代碼示例>>Java>>正文


Java Fork類代碼示例

本文整理匯總了Java中org.openjdk.jmh.annotations.Fork的典型用法代碼示例。如果您正苦於以下問題:Java Fork類的具體用法?Java Fork怎麽用?Java Fork使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Fork類屬於org.openjdk.jmh.annotations包,在下文中一共展示了Fork類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testApi

import org.openjdk.jmh.annotations.Fork; //導入依賴的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.Fork; //導入依賴的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: timeMergeAndBuild

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例4: generateImport

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例5: testCascadedValidation

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例6: testCascadedValidation

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例7: none

import org.openjdk.jmh.annotations.Fork; //導入依賴的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();
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:15,代碼來源:ThreadInstrumentationBenchmark.java

示例8: manual

import org.openjdk.jmh.annotations.Fork; //導入依賴的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();
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:15,代碼來源:ThreadInstrumentationBenchmark.java

示例9: automatic

import org.openjdk.jmh.annotations.Fork; //導入依賴的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();
}
 
開發者ID:census-instrumentation,項目名稱:opencensus-java,代碼行數:15,代碼來源:ThreadInstrumentationBenchmark.java

示例10: none

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例11: manual

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例12: automatic

import org.openjdk.jmh.annotations.Fork; //導入依賴的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

示例13: filterWithoutSleuth

import org.openjdk.jmh.annotations.Fork; //導入依賴的package包/類
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithoutSleuth(BenchmarkContext context)
		throws IOException, ServletException {
	MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
	MockHttpServletResponse response = new MockHttpServletResponse();
	response.setContentType(MediaType.APPLICATION_JSON_VALUE);

	context.dummyFilter.doFilter(request, response, new MockFilterChain());
}
 
開發者ID:reshmik,項目名稱:Zipkin,代碼行數:12,代碼來源:HttpFilterBenchmarks.java

示例14: filterWithSleuth

import org.openjdk.jmh.annotations.Fork; //導入依賴的package包/類
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithSleuth(BenchmarkContext context)
		throws ServletException, IOException {
	MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
	MockHttpServletResponse response = new MockHttpServletResponse();
	response.setContentType(MediaType.APPLICATION_JSON_VALUE);

	context.traceFilter.doFilter(request, response, new MockFilterChain());
}
 
開發者ID:reshmik,項目名稱:Zipkin,代碼行數:12,代碼來源:HttpFilterBenchmarks.java

示例15: CI

import org.openjdk.jmh.annotations.Fork; //導入依賴的package包/類
@Benchmark
/*Result "benchmarkCurrentImplementation":
696.179 ±(99.9%) 10.576 ns/op [Average]
(min, avg, max) = (638.682, 696.179, 1119.323), stdev = 44.779
CI (99.9%): [685.603, 706.754] (assumes normal distribution)
*/
@Fork(jvmArgsAppend = {MAX_MEM, G1})
public byte[] benchmarkCurrentImplementation() {
	return SimpleCounter.getBarcodeConsensus(barcodes, 4);
}
 
開發者ID:cinquin,項目名稱:mutinack,代碼行數:11,代碼來源:BenchmarkGetBarcodeConsensus.java


注:本文中的org.openjdk.jmh.annotations.Fork類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。