Java Code Examples for org.openjdk.jmh.annotations.Level#Invocation

The following examples show how to use org.openjdk.jmh.annotations.Level#Invocation . 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: MeasureKeyValuePairSort.java    From headlong with Apache License 2.0 6 votes vote down vote up
@Setup(Level.Invocation)
public void init() {
    rand.setSeed(rand.nextLong() + System.nanoTime());

    arrayList.clear();

    byte[] key, value;
    for (int i = 0; i < SIZE; i++) {
        key = new byte[MIN_KEY_LEN + rand.nextInt(KEY_LEN_BOUND - MIN_KEY_LEN)];
        value = new byte[rand.nextInt(VALUE_LEN_BOUND)];
        rand.nextBytes(key);
        rand.nextBytes(value);
        KeyValuePair pair = new KeyValuePair(key, value);
        array[i] = pair;
        arrayList.add(pair);
    }
    arraysArrayList = Arrays.asList(Arrays.copyOf(array, array.length));
}
 
Example 2
Source File: WorldStateDownloaderBenchmark.java    From besu with Apache License 2.0 5 votes vote down vote up
@TearDown(Level.Invocation)
public void tearDown() throws Exception {
  ethProtocolManager.stop();
  ethProtocolManager.awaitStop();
  pendingRequests.close();
  storageProvider.close();
  MoreFiles.deleteRecursively(tempDir, RecursiveDeleteOption.ALLOW_INSECURE);
}
 
Example 3
Source File: BenchmarkSpatialJoin.java    From presto with Apache License 2.0 5 votes vote down vote up
@TearDown(Level.Invocation)
public void dropPointsTable()
{
    queryRunner.inTransaction(queryRunner.getDefaultSession(), transactionSession -> {
        Metadata metadata = queryRunner.getMetadata();
        Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, QualifiedObjectName.valueOf("memory.default.points"));
        assertTrue(tableHandle.isPresent(), "Table memory.default.points does not exist");
        metadata.dropTable(transactionSession, tableHandle.get());
        return null;
    });
}
 
Example 4
Source File: HeadersBenchmark.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Invocation)
public void setupEmptyHeaders() {
    emptyHttpHeaders.clear();
    emptyHttp2Headers .clear();
    emptyHttpHeadersNoValidate.clear();
    emptyHttp2HeadersNoValidate.clear();
}
 
Example 5
Source File: ScheduledFutureTaskBenchmark.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Invocation)
public void reset() {
    futures.clear();
    executor.submit(new Runnable() {
        @Override
        public void run() {
            for (int i = 1; i <= num; i++) {
                futures.add(executor.schedule(NO_OP, i, TimeUnit.HOURS));
            }
        }
    }).syncUninterruptibly();
}
 
Example 6
Source File: LauncherState.java    From spring-init with Apache License 2.0 5 votes vote down vote up
@Override
@TearDown(Level.Invocation)
public void close() throws IOException {
	// CachedIntrospectionResults.clearClassLoader(getClass().getClassLoader());
	if (instance != null) {
		instance.close();
	}
	if (runThread != null) {
		runThread.setContextClassLoader(null);
		runThread = null;
	}
	if (orig != null) {
		ClassUtils.overrideThreadContextClassLoader(orig);
	}
	if (loader != null) {
		try {
			loader.close();
			loader = null;
		}
		catch (Exception e) {
			System.err.println("Failed to close loader " + e);
		}
	}
	System.gc();
	for (Object key : this.args.keySet()) {
		System.clearProperty(key.toString());
	}
}
 
Example 7
Source File: LauncherState.java    From spring-init with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Invocation)
public void start() throws Exception {
	System.setProperty("server.port", "0");
	System.setProperty("spring.jmx.enabled", "false");
	System.setProperty("spring.config.location",
			"file:./src/main/resources/application.properties");
	System.setProperty("spring.main.logStartupInfo", "false");
	for (Object key : this.args.keySet()) {
		System.setProperty(key.toString(), this.args.getProperty(key.toString()));
	}
}
 
Example 8
Source File: ActrBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
	super.after();
}
 
Example 9
Source File: WorldStateDownloaderBenchmark.java    From besu with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Invocation)
public void setUpUnchangedState() {
  final SynchronizerConfiguration syncConfig =
      new SynchronizerConfiguration.Builder().worldStateHashCountPerRequest(200).build();
  final Hash stateRoot = createExistingWorldState();
  blockHeader = new BlockHeaderTestFixture().stateRoot(stateRoot).buildHeader();

  tempDir = Files.createTempDir().toPath();
  ethProtocolManager =
      EthProtocolManagerTestUtil.create(
          new EthScheduler(
              syncConfig.getDownloaderParallelism(),
              syncConfig.getTransactionsParallelism(),
              syncConfig.getComputationParallelism(),
              metricsSystem));

  peer = EthProtocolManagerTestUtil.createPeer(ethProtocolManager, blockHeader.getNumber());

  final EthContext ethContext = ethProtocolManager.ethContext();

  final StorageProvider storageProvider =
      createKeyValueStorageProvider(tempDir, tempDir.resolve("database"));
  worldStateStorage = storageProvider.createWorldStateStorage();

  pendingRequests =
      new CachingTaskCollection<>(
          new FlatFileTaskCollection<>(
              tempDir.resolve("fastsync"),
              NodeDataRequest::serialize,
              NodeDataRequest::deserialize),
          0);
  worldStateDownloader =
      new WorldStateDownloader(
          ethContext,
          worldStateStorage,
          pendingRequests,
          syncConfig.getWorldStateHashCountPerRequest(),
          syncConfig.getWorldStateRequestParallelism(),
          syncConfig.getWorldStateMaxRequestsWithoutProgress(),
          syncConfig.getWorldStateMinMillisBeforeStalling(),
          Clock.fixed(Instant.ofEpochSecond(1000), ZoneOffset.UTC),
          metricsSystem);
}
 
Example 10
Source File: MainBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
	super.after();
}
 
Example 11
Source File: LazyBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
	super.after();
}
 
Example 12
Source File: SlimBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
	super.after();
}
 
Example 13
Source File: ManualBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
	super.after();
}
 
Example 14
Source File: MeasurePadding.java    From headlong with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Invocation)
public void setUp() {
    bb.position(32);
    paddingLen = r.nextInt(UNIT_LENGTH_BYTES);
    negativeOnes = r.nextBoolean();
}
 
Example 15
Source File: AsyncContextMapBenchmark.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Invocation)
public final void setup() {
    AsyncContext.clear();
}
 
Example 16
Source File: CodecOutputListBenchmark.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Invocation)
public void setup() {
    codecOutputList = CodecOutputList.newInstance();
    recycleableArrayList = RecyclableArrayList.newInstance(16);
    arrayList = new ArrayList<Object>(16);
}
 
Example 17
Source File: CacheBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
    super.close();
}
 
Example 18
Source File: SimpleBenchmark.java    From spring-boot-graal-feature with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
	super.after();
}
 
Example 19
Source File: PetClinicBenchmarkIT.java    From spring-init with Apache License 2.0 4 votes vote down vote up
@TearDown(Level.Invocation)
public void stop() throws Exception {
    super.after();
}
 
Example 20
Source File: BenchmarkDictionaryBlockGetSizeInBytes.java    From presto with Apache License 2.0 4 votes vote down vote up
@Setup(Level.Invocation)
public void setup()
{
    dictionaryBlock = new DictionaryBlock(createMapBlock(POSITIONS), generateIds(Integer.parseInt(selectedPositions), POSITIONS));
}