Search in sources :

Example 76 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class AsyncLoggersLocationBenchmark method up.

@Setup(Level.Trial)
public void up() {
    System.setProperty("log4j.configurationFile", "perf-WithoutAnyAppender-location.xml");
    System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
    System.setProperty("AsyncLogger.RingBufferSize", "262144");
    System.setProperty("AsyncLogger.WaitStrategy", "Yield");
    //System.setProperty("log4j2.enable.threadlocals", "true");
    //System.setProperty("log4j.format.msg.async", "true");
    logger = LogManager.getLogger(getClass());
    new File("perftest.log").delete();
}
Also used : File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Example 77 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class FormatterLoggerBenchmark method up.

@Setup(Level.Trial)
public void up() {
    new File("perftest.log").delete();
    System.setProperty("log4j.configurationFile", "perf3PlainNoLoc.xml");
    logger = LogManager.getLogger(getClass());
    formatterLogger = LogManager.getLogger("formatter", new StringFormatterMessageFactory());
}
Also used : StringFormatterMessageFactory(org.apache.logging.log4j.message.StringFormatterMessageFactory) File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Example 78 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class AsyncLoggersBenchmark method up.

@Setup(Level.Trial)
public void up() {
    System.setProperty("log4j.configurationFile", "perf-WithoutAnyAppender.xml");
    System.setProperty("Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
    System.setProperty("AsyncLogger.RingBufferSize", "262144");
    System.setProperty("AsyncLogger.WaitStrategy", "Yield");
    //System.setProperty("log4j2.enable.threadlocals", "true");
    //System.setProperty("log4j.format.msg.async", "true");
    logger = LogManager.getLogger(getClass());
    new File("perftest.log").delete();
}
Also used : File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Example 79 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class MemoryHandlerJULBenchmark method up.

@Setup(Level.Trial)
public void up() {
    memoryHandler = new MemoryHandler(new NoOpJULHandler(), 262144, java.util.logging.Level.SEVERE);
    logger = java.util.logging.Logger.getLogger(getClass().getName());
    logger.setUseParentHandlers(false);
    logger.addHandler(memoryHandler);
    logger.setLevel(java.util.logging.Level.ALL);
}
Also used : MemoryHandler(java.util.logging.MemoryHandler) NoOpJULHandler(org.apache.logging.log4j.perf.util.NoOpJULHandler) Setup(org.openjdk.jmh.annotations.Setup)

Example 80 with Setup

use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.

the class ThreadContextBenchmark method setup.

@Setup
public void setup() {
    System.setProperty("log4j2.threadContextMap", IMPLEMENTATIONS.get(threadContextMapAlias).getName());
    ThreadContextBenchmarkAccess.init();
    injector = ContextDataInjectorFactory.createInjector();
    System.out.println(threadContextMapAlias + ": Injector = " + injector);
    reusableContextData = threadContextMapAlias.contains("Array") ? new SortedArrayStringMap() : new OpenHashStringMap<>();
    keys = new String[count];
    values = new String[count];
    final Random r = new Random();
    for (int j = 0; j < keys.length; j++) {
        final char[] str = new char[KEY_LENGTH];
        for (int i = 0; i < str.length; i++) {
            str[i] = (char) r.nextInt();
        }
        keys[j] = new String(str);
        values[j] = new String(str);
    }
    // count
    final int PROPERTIES_COUNT = 5;
    propertyList = new ArrayList<>(PROPERTIES_COUNT);
    for (int j = 0; j < PROPERTIES_COUNT; j++) {
        final char[] str = new char[KEY_LENGTH];
        for (int i = 0; i < str.length; i++) {
            str[i] = (char) r.nextInt();
        }
        propertyList.add(Property.createProperty(new String(str), new String(str)));
    }
    // ensure ThreadContext contains values
    clearAndPut();
}
Also used : Random(java.util.Random) SortedArrayStringMap(org.apache.logging.log4j.util.SortedArrayStringMap) OpenHashStringMap(org.apache.logging.log4j.perf.nogc.OpenHashStringMap) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Setup (org.openjdk.jmh.annotations.Setup)80 File (java.io.File)19 InputRow (io.druid.data.input.InputRow)15 BenchmarkDataGenerator (io.druid.benchmark.datagen.BenchmarkDataGenerator)14 HyperUniquesSerde (io.druid.query.aggregation.hyperloglog.HyperUniquesSerde)14 Random (java.util.Random)11 IndexSpec (io.druid.segment.IndexSpec)10 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)8 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)8 QueryableIndex (io.druid.segment.QueryableIndex)7 ByteBuffer (java.nio.ByteBuffer)7 StupidPool (io.druid.collections.StupidPool)4 OffheapBufferGenerator (io.druid.offheap.OffheapBufferGenerator)4 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 AtomicLong (java.util.concurrent.atomic.AtomicLong)4 Function (com.google.common.base.Function)3 BitmapFactory (io.druid.collections.bitmap.BitmapFactory)3 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)3 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)3