GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make the build run faster (#16290) · netty/netty@f0fe411

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • buffer/src/test
    • java/io/netty/buffer
      • AbstractByteBufTest.java
      • AdaptiveByteBufAllocatorTest.java
      • JfrEventsTest.java
      • PooledByteBufAllocatorTest.java
      • ReadOnlyDirectByteBufferBufTest.java
    • resources
      • junit-platform.properties
  • common/src/main/java/io/netty/util
    • LeakPresenceDetector.java
  • handler/src/test/resources
    • junit-platform.properties
  • testsuite-common/src/main/java/io/netty/util/test
    • LeakPresenceExtension.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2335,7 +2335,7 @@ public void run() {
23352335
}
23362336

23372337
@Test
2338-
@Timeout(value = 10000, unit = TimeUnit.MILLISECONDS)
2338+
@Timeout(60)
23392339
public void testCopyMultipleThreads0() throws Throwable {
23402340
byte[] bytes = new byte[8];
23412341
random.nextBytes(bytes);
Collapse file

‎buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java
+2-181Lines changed: 2 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,20 @@
1616
package io.netty.buffer;
1717

1818
import io.netty.util.NettyRuntime;
19-
import io.netty.util.concurrent.FastThreadLocalThread;
20-
import jdk.jfr.consumer.RecordedEvent;
21-
import jdk.jfr.consumer.RecordingStream;
19+
import io.netty.util.test.DisabledForSlowLeakDetection;
2220
import org.junit.jupiter.api.RepeatedTest;
2321
import org.junit.jupiter.api.RepetitionInfo;
2422
import org.junit.jupiter.api.Test;
25-
import org.junit.jupiter.api.Timeout;
26-
import org.junit.jupiter.api.condition.EnabledForJreRange;
27-
import org.junit.jupiter.api.condition.JRE;
2823
import org.junit.jupiter.params.ParameterizedTest;
2924
import org.junit.jupiter.params.provider.ValueSource;
3025

3126
import java.lang.reflect.Array;
3227
import java.util.ArrayDeque;
33-
import java.util.ArrayList;
3428
import java.util.Arrays;
3529
import java.util.Deque;
36-
import java.util.List;
3730
import java.util.SplittableRandom;
38-
import java.util.concurrent.Callable;
39-
import java.util.concurrent.CompletableFuture;
4031
import java.util.concurrent.CountDownLatch;
41-
import java.util.concurrent.FutureTask;
4232
import java.util.concurrent.ThreadLocalRandom;
43-
import java.util.concurrent.atomic.AtomicInteger;
4433
import java.util.concurrent.atomic.AtomicReference;
4534

4635
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -223,175 +212,7 @@ public void run() {
223212
}
224213
}
225214

226-
@SuppressWarnings("Since15")
227-
@Test
228-
@EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
229-
@Timeout(10)
230-
public void jfrChunkAllocation() throws Exception {
231-
try (RecordingStream stream = new RecordingStream()) {
232-
CompletableFuture<RecordedEvent> allocateFuture = new CompletableFuture<>();
233-
234-
stream.enable(AllocateChunkEvent.class);
235-
stream.onEvent(AllocateChunkEvent.NAME, allocateFuture::complete);
236-
stream.startAsync();
237-
238-
AdaptiveByteBufAllocator alloc = new AdaptiveByteBufAllocator(true, false);
239-
alloc.directBuffer(128).release();
240-
241-
RecordedEvent allocate = allocateFuture.get();
242-
assertEquals(AdaptivePoolingAllocator.MIN_CHUNK_SIZE, allocate.getInt("capacity"));
243-
assertTrue(allocate.getBoolean("pooled"));
244-
assertFalse(allocate.getBoolean("threadLocal"));
245-
assertTrue(allocate.getBoolean("direct"));
246-
}
247-
}
248-
249-
@SuppressWarnings("Since15")
250-
@Test
251-
@EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
252-
@Timeout(10)
253-
public void shouldCreateTwoChunks() throws Exception {
254-
try (RecordingStream stream = new RecordingStream()) {
255-
final CountDownLatch eventsFlushed = new CountDownLatch(2);
256-
stream.enable(AllocateChunkEvent.class);
257-
stream.onEvent(AllocateChunkEvent.NAME,
258-
event -> {
259-
eventsFlushed.countDown();
260-
});
261-
stream.startAsync();
262-
ByteBufAllocator allocator = newAllocator(false);
263-
int bufSize = 16896;
264-
int minSegmentsPerChunk = 32; // See AdaptivePoolingAllocator.SizeClassChunkController.
265-
int bufsToAllocate = 1 + minSegmentsPerChunk;
266-
List<ByteBuf> buffers = new ArrayList<>(bufsToAllocate);
267-
for (int i = 0; i < bufsToAllocate; ++i) {
268-
buffers.add(allocator.heapBuffer(bufSize, bufSize));
269-
}
270-
// release all buffers
271-
for (ByteBuf buffer : buffers) {
272-
buffer.release();
273-
}
274-
buffers.clear();
275-
eventsFlushed.await();
276-
assertEquals(0, eventsFlushed.getCount());
277-
}
278-
}
279-
280-
@SuppressWarnings("Since15")
281-
@Test
282-
@EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
283-
@Timeout(10)
284-
public void shouldReuseTheSameChunk() throws Exception {
285-
try (RecordingStream stream = new RecordingStream()) {
286-
final CountDownLatch eventsFlushed = new CountDownLatch(1);
287-
final AtomicInteger chunksAllocations = new AtomicInteger();
288-
stream.enable(AllocateChunkEvent.class);
289-
stream.onEvent(AllocateChunkEvent.NAME,
290-
event -> {
291-
chunksAllocations.incrementAndGet();
292-
eventsFlushed.countDown();
293-
});
294-
stream.startAsync();
295-
int bufSize = 16896;
296-
ByteBufAllocator allocator = newAllocator(false);
297-
List<ByteBuf> buffers = new ArrayList<>(32);
298-
for (int i = 0; i < 30; ++i) {
299-
buffers.add(allocator.heapBuffer(bufSize, bufSize));
300-
}
301-
// we still have 2 available segments in the chunk, so we should not allocate a new one
302-
for (int i = 0; i < 128; ++i) {
303-
allocator.heapBuffer(bufSize, bufSize).release();
304-
}
305-
// release all buffers
306-
for (ByteBuf buffer : buffers) {
307-
buffer.release();
308-
}
309-
buffers.clear();
310-
eventsFlushed.await();
311-
assertEquals(1, chunksAllocations.get());
312-
}
313-
}
314-
315-
@SuppressWarnings("Since15")
316-
@Test
317-
@EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
318-
@Timeout(10)
319-
public void jfrBufferAllocation() throws Exception {
320-
try (RecordingStream stream = new RecordingStream()) {
321-
CompletableFuture<RecordedEvent> allocateFuture = new CompletableFuture<>();
322-
CompletableFuture<RecordedEvent> releaseFuture = new CompletableFuture<>();
323-
324-
stream.enable(AllocateBufferEvent.class);
325-
stream.onEvent(AllocateBufferEvent.NAME, allocateFuture::complete);
326-
stream.enable(FreeBufferEvent.class);
327-
stream.onEvent(FreeBufferEvent.NAME, releaseFuture::complete);
328-
stream.startAsync();
329-
330-
AdaptiveByteBufAllocator alloc = new AdaptiveByteBufAllocator(true, false);
331-
alloc.directBuffer(128).release();
332-
333-
RecordedEvent allocate = allocateFuture.get();
334-
assertEquals(128, allocate.getInt("size"));
335-
assertEquals(128, allocate.getInt("maxFastCapacity"));
336-
assertEquals(Integer.MAX_VALUE, allocate.getInt("maxCapacity"));
337-
assertTrue(allocate.getBoolean("chunkPooled"));
338-
assertFalse(allocate.getBoolean("chunkThreadLocal"));
339-
assertTrue(allocate.getBoolean("direct"));
340-
341-
RecordedEvent release = releaseFuture.get();
342-
assertEquals(128, release.getInt("size"));
343-
assertEquals(128, release.getInt("maxFastCapacity"));
344-
assertEquals(Integer.MAX_VALUE, release.getInt("maxCapacity"));
345-
assertTrue(release.getBoolean("direct"));
346-
}
347-
}
348-
349-
@SuppressWarnings("Since15")
350-
@Test
351-
@EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
352-
@Timeout(10)
353-
public void jfrBufferAllocationThreadLocal() throws Exception {
354-
ByteBufAllocator alloc = new AdaptiveByteBufAllocator(true, true);
355-
356-
Callable<Void> allocateAndRelease = () -> {
357-
try (RecordingStream stream = new RecordingStream()) {
358-
CompletableFuture<RecordedEvent> allocateFuture = new CompletableFuture<>();
359-
CompletableFuture<RecordedEvent> releaseFuture = new CompletableFuture<>();
360-
361-
// Prime the cache.
362-
alloc.directBuffer(128).release();
363-
364-
stream.enable(AllocateBufferEvent.class);
365-
stream.onEvent(AllocateBufferEvent.NAME, allocateFuture::complete);
366-
stream.enable(FreeBufferEvent.class);
367-
stream.onEvent(FreeBufferEvent.NAME, releaseFuture::complete);
368-
stream.startAsync();
369-
370-
// Allocate out of the cache.
371-
alloc.directBuffer(128).release();
372-
373-
RecordedEvent allocate = allocateFuture.get();
374-
assertEquals(128, allocate.getInt("size"));
375-
assertEquals(128, allocate.getInt("maxFastCapacity"));
376-
assertEquals(Integer.MAX_VALUE, allocate.getInt("maxCapacity"));
377-
assertTrue(allocate.getBoolean("chunkPooled"));
378-
assertTrue(allocate.getBoolean("chunkThreadLocal"));
379-
assertTrue(allocate.getBoolean("direct"));
380-
381-
RecordedEvent release = releaseFuture.get();
382-
assertEquals(128, release.getInt("size"));
383-
assertEquals(128, release.getInt("maxFastCapacity"));
384-
assertEquals(Integer.MAX_VALUE, release.getInt("maxCapacity"));
385-
assertTrue(release.getBoolean("direct"));
386-
return null;
387-
}
388-
};
389-
FutureTask<Void> task = new FutureTask<>(allocateAndRelease);
390-
FastThreadLocalThread thread = new FastThreadLocalThread(task);
391-
thread.start();
392-
task.get();
393-
}
394-
215+
@DisabledForSlowLeakDetection
395216
@RepeatedTest(100)
396217
void buddyAllocationConsistency(RepetitionInfo info) {
397218
SplittableRandom rng = new SplittableRandom(info.getCurrentRepetition());

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.