Search in sources :

Example 31 with Setup

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

the class JpaAppenderBenchmark method setup.

@Setup
public void setup() throws Exception {
    connectionHSQLDB = getConnectionHSQLDB();
    connectionH2 = getConnectionH2();
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, "log4j2-jpa-appender.xml");
    final LoggerContext context = LoggerContext.getContext(false);
    if (context.getConfiguration() instanceof DefaultConfiguration) {
        context.reconfigure();
    }
    StatusLogger.getLogger().reset();
    loggerH2 = LogManager.getLogger("H2Logger");
    loggerHSQLDB = LogManager.getLogger("HSQLDBLogger");
}
Also used : DefaultConfiguration(org.apache.logging.log4j.core.config.DefaultConfiguration) LoggerContext(org.apache.logging.log4j.core.LoggerContext) Setup(org.openjdk.jmh.annotations.Setup)

Example 32 with Setup

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

the class AbstractStringLayoutStringEncodingBenchmark method setUp.

@Setup
public void setUp() {
    bytes = new byte[128];
    for (int i = 0; i < bytes.length; i++) {
        bytes[i] = (byte) i;
    }
    usAsciiGetBytesLayout = new GetBytesLayout(Charset.forName("US-ASCII"));
    iso8859_1GetBytesLayout = new GetBytesLayout(Charset.forName("ISO-8859-1"));
    utf8GetBytesLayout = new GetBytesLayout(Charset.forName("UTF-8"));
    utf16GetBytesLayout = new GetBytesLayout(Charset.forName("UTF-16"));
    usAsciiEncodeLayout = new EncodeLayout(Charset.forName("US-ASCII"));
    iso8859_1EncodeLayout = new EncodeLayout(Charset.forName("ISO-8859-1"));
    utf8EncodeLayout = new EncodeLayout(Charset.forName("UTF-8"));
    utf16EncodeLayout = new EncodeLayout(Charset.forName("UTF-16"));
    final StringBuilder msg = new StringBuilder();
    msg.append(MESSAGE);
    logEvent = createLogEvent(new SimpleMessage(msg));
    destination = new Destination();
}
Also used : ByteBufferDestination(org.apache.logging.log4j.core.layout.ByteBufferDestination) SimpleMessage(org.apache.logging.log4j.message.SimpleMessage) Setup(org.openjdk.jmh.annotations.Setup)

Example 33 with Setup

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

the class FileAppenderParamsBenchmark method setUp.

@Setup
public void setUp() throws Exception {
    System.setProperty("log4j.configurationFile", "log4j2-perf.xml");
    System.setProperty("log4j.configuration", "log4j12-perf.xml");
    System.setProperty("logback.configurationFile", "logback-perf.xml");
    deleteLogFiles();
    log4j2Logger = LogManager.getLogger(getClass());
    log4j2RandomLogger = LogManager.getLogger("TestRandom");
    slf4jLogger = LoggerFactory.getLogger(getClass());
    log4j1Logger = org.apache.log4j.Logger.getLogger(getClass());
    julFileHandler = new FileHandler("target/testJulLog.log");
    julLogger = java.util.logging.Logger.getLogger(getClass().getName());
    julLogger.setUseParentHandlers(false);
    julLogger.addHandler(julFileHandler);
    julLogger.setLevel(Level.ALL);
    j = 0;
}
Also used : FileHandler(java.util.logging.FileHandler) Setup(org.openjdk.jmh.annotations.Setup)

Example 34 with Setup

use of org.openjdk.jmh.annotations.Setup in project presto by prestodb.

the class HiveFileFormatBenchmark method setup.

@Setup
public void setup() throws IOException {
    data = dataSet.createTestData(fileFormat);
    targetDir.mkdirs();
    dataFile = new File(targetDir, UUID.randomUUID().toString());
    writeData(dataFile);
}
Also used : File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Example 35 with Setup

use of org.openjdk.jmh.annotations.Setup in project presto by prestodb.

the class InCodeGeneratorBenchmark method setup.

@Setup
public void setup() {
    Random random = new Random();
    RowExpression[] arguments = new RowExpression[1 + inListCount];
    switch(type) {
        case StandardTypes.BIGINT:
            prestoType = BIGINT;
            for (int i = 1; i <= inListCount; i++) {
                arguments[i] = constant((long) random.nextInt(), BIGINT);
            }
            break;
        case StandardTypes.DOUBLE:
            prestoType = DOUBLE;
            for (int i = 1; i <= inListCount; i++) {
                arguments[i] = constant(random.nextDouble(), DOUBLE);
            }
            break;
        case StandardTypes.VARCHAR:
            prestoType = VARCHAR;
            for (int i = 1; i <= inListCount; i++) {
                arguments[i] = constant(Slices.utf8Slice(Long.toString(random.nextLong())), VARCHAR);
            }
            break;
        default:
            throw new IllegalStateException();
    }
    arguments[0] = field(0, prestoType);
    RowExpression project = field(0, prestoType);
    PageBuilder pageBuilder = new PageBuilder(ImmutableList.of(prestoType));
    for (int i = 0; i < 10_000; i++) {
        pageBuilder.declarePosition();
        switch(type) {
            case StandardTypes.BIGINT:
                BIGINT.writeLong(pageBuilder.getBlockBuilder(0), random.nextInt());
                break;
            case StandardTypes.DOUBLE:
                DOUBLE.writeDouble(pageBuilder.getBlockBuilder(0), random.nextDouble());
                break;
            case StandardTypes.VARCHAR:
                VARCHAR.writeSlice(pageBuilder.getBlockBuilder(0), Slices.utf8Slice(Long.toString(random.nextLong())));
                break;
        }
    }
    inputPage = pageBuilder.build();
    RowExpression filter = call(new Signature(IN, SCALAR, parseTypeSignature(StandardTypes.BOOLEAN)), BOOLEAN, arguments);
    processor = new ExpressionCompiler(MetadataManager.createTestMetadataManager()).compilePageProcessor(filter, ImmutableList.of(project)).get();
}
Also used : Random(java.util.Random) Signature(com.facebook.presto.metadata.Signature) TypeSignature.parseTypeSignature(com.facebook.presto.spi.type.TypeSignature.parseTypeSignature) RowExpression(com.facebook.presto.sql.relational.RowExpression) PageBuilder(com.facebook.presto.spi.PageBuilder) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

Setup (org.openjdk.jmh.annotations.Setup)88 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