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");
}
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();
}
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;
}
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);
}
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();
}
Aggregations