Home / Function/ setupAllocatorAndPollute() — netty Function Reference

setupAllocatorAndPollute() — netty Function Reference

Architecture documentation for the setupAllocatorAndPollute() function in ByteBufAllocatorAllocPatternBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  08c39d59_9fc8_19d0_9a47_4c56e7a2655c["setupAllocatorAndPollute()"]
  e4bd297f_3f76_67a0_e907_259f9a219484["ByteBufAllocatorAllocPatternBenchmark"]
  08c39d59_9fc8_19d0_9a47_4c56e7a2655c -->|defined in| e4bd297f_3f76_67a0_e907_259f9a219484
  5434ee01_3cf8_3416_b95e_92d02dcc98a8["setup()"]
  08c39d59_9fc8_19d0_9a47_4c56e7a2655c -->|calls| 5434ee01_3cf8_3416_b95e_92d02dcc98a8
  fe84fc40_3a97_c97a_73cb_2217baa430ed["performDirectAllocation()"]
  08c39d59_9fc8_19d0_9a47_4c56e7a2655c -->|calls| fe84fc40_3a97_c97a_73cb_2217baa430ed
  26bf866c_3b1b_fbfe_7ea6_9d3c0dcb9920["performHeapAllocation()"]
  08c39d59_9fc8_19d0_9a47_4c56e7a2655c -->|calls| 26bf866c_3b1b_fbfe_7ea6_9d3c0dcb9920
  52227b39_333e_671f_f152_23356efc596d["tearDown()"]
  08c39d59_9fc8_19d0_9a47_4c56e7a2655c -->|calls| 52227b39_333e_671f_f152_23356efc596d
  style 08c39d59_9fc8_19d0_9a47_4c56e7a2655c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/ByteBufAllocatorAllocPatternBenchmark.java lines 175–211

    @Setup
    public void setupAllocatorAndPollute(BenchmarkParams params) throws InterruptedException {
        allocator = allocatorType.create();
        if (pollutionIterations == 0) {
            return;
        }

        final boolean directAllocation = params.getBenchmark().contains("Direct");

        int perThreadIterations = pollutionIterations / 2;

        Runnable pollutionTask = () -> {
            AllocationPatternState state = new AllocationPatternState();
            state.setup(this);
            try {
                if (directAllocation) {
                    for (int i = 0; i < perThreadIterations; i++) {
                        state.performDirectAllocation();
                    }
                } else {
                    for (int i = 0; i < perThreadIterations; i++) {
                        state.performHeapAllocation();
                    }
                }
            } finally {
                state.tearDown();
            }
        };

        Thread normalThread = new Thread(pollutionTask);
        Thread fastThread = new FastThreadLocalThread(pollutionTask);

        normalThread.start();
        fastThread.start();
        normalThread.join();
        fastThread.join();
    }

Domain

Subdomains

Frequently Asked Questions

What does setupAllocatorAndPollute() do?
setupAllocatorAndPollute() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufAllocatorAllocPatternBenchmark.java.
Where is setupAllocatorAndPollute() defined?
setupAllocatorAndPollute() is defined in microbench/src/main/java/io/netty/microbench/buffer/ByteBufAllocatorAllocPatternBenchmark.java at line 175.
What does setupAllocatorAndPollute() call?
setupAllocatorAndPollute() calls 4 function(s): performDirectAllocation, performHeapAllocation, setup, tearDown.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free