Java Code Examples for org.openjdk.jmh.infra.BenchmarkParams#getThreads()

The following examples show how to use org.openjdk.jmh.infra.BenchmarkParams#getThreads() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PerfTestFairQueuingPacketScheduler.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Setup(Level.Trial)
public void setup(BenchmarkParams params) {
   clock = NetworkClocks.system();
   scheduler = PacketSchedulers.<Packet>fairQueuing()
      .blockOnQueueFull()
      //.useArrayQueue(qSize)
      //.useLinkedQueue(qSize)
      .useLinkedTransferQueue()
      .build();

   producers = new PacketScheduler.Producer[params.getThreads()][qPerThr];
   for (int p = 0; p < producers.length; ++p) {
      for (int q = 0; q < producers[p].length; ++q) {
         producers[p][q] = scheduler.attach();
      }
   }
}
 
Example 2
Source File: PopulateParallelOnceBenchmark.java    From cache2k-benchmark with Apache License 2.0 5 votes vote down vote up
@Benchmark @BenchmarkMode(Mode.SingleShotTime)
public long populateChunkInCache(ThreadState ts, BenchmarkParams p) {
  int _chunkSize = entryCount / p.getThreads();
  int _startIndex = offset.getAndAdd(_chunkSize);
  int _endIndex = _startIndex + _chunkSize;
  for (int i = _startIndex; i < _endIndex; i++) {
    cache.put(i, (Integer) i);
  }
  ts.operations = _chunkSize;
  return _chunkSize;
}
 
Example 3
Source File: JMHSample_31_InfraParams.java    From jmh-playground with Apache License 2.0 4 votes vote down vote up
@Setup
public void setup(BenchmarkParams params) {
    int capacity = 16 * THREAD_SLICE * params.getThreads();
    mapSingle        = new ConcurrentHashMap<>(capacity, 0.75f, 1);
    mapFollowThreads = new ConcurrentHashMap<>(capacity, 0.75f, params.getThreads());
}