use of org.openjdk.jmh.annotations.Setup in project netty by netty.
the class HeadersBenchmark method setup.
@Setup(Level.Trial)
public void setup() {
Map<String, String> headers = ExampleHeaders.EXAMPLES.get(exampleHeader);
httpNames = new AsciiString[headers.size()];
http2Names = new AsciiString[headers.size()];
httpValues = new AsciiString[headers.size()];
httpHeaders = new DefaultHttpHeaders(false);
http2Headers = new DefaultHttp2Headers(false);
int idx = 0;
for (Map.Entry<String, String> header : headers.entrySet()) {
String name = header.getKey();
String httpName = toHttpName(name);
String http2Name = toHttp2Name(name);
String value = header.getValue();
httpNames[idx] = new AsciiString(httpName);
http2Names[idx] = new AsciiString(http2Name);
httpValues[idx] = new AsciiString(value);
httpHeaders.add(httpNames[idx], httpValues[idx]);
http2Headers.add(http2Names[idx], httpValues[idx]);
idx++;
}
slowHttp2Headers = new SlowHeaders(http2Headers);
emptyHttpHeaders = new DefaultHttpHeaders(true);
emptyHttp2Headers = new DefaultHttp2Headers(true);
emptyHttpHeadersNoValidate = new DefaultHttpHeaders(false);
emptyHttp2HeadersNoValidate = new DefaultHttp2Headers(false);
}
use of org.openjdk.jmh.annotations.Setup in project netty by netty.
the class ReadOnlyHttp2HeadersBenchmark method setUp.
@Setup
public void setUp() throws Exception {
headerNames = new AsciiString[headerCount];
headerValues = new AsciiString[headerCount];
for (int i = 0; i < headerCount; ++i) {
headerNames[i] = new AsciiString("key-" + i);
headerValues[i] = new AsciiString(UUID.randomUUID().toString());
}
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class MemoryHandlerJULLocationBenchmark method up.
@Setup(Level.Trial)
public void up() {
memoryHandler = new MemoryHandler(new NoOpJULHandler(), 262144, java.util.logging.Level.SEVERE);
logger = Logger.getLogger(getClass().getName());
logger.setUseParentHandlers(false);
logger.addHandler(memoryHandler);
logger.setLevel(java.util.logging.Level.ALL);
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class SortedArrayVsHashMapBenchmark method setup.
@Setup
public void setup() {
openHashMapContextData = new OpenHashStringMap<>();
sortedStringArrayMap = new SortedArrayStringMap();
map = new HashMap<>();
keys = new String[count];
final Random r = new Random();
for (int j = 0; j < keys.length; j++) {
final char[] str = new char[length];
for (int i = 0; i < str.length; i++) {
str[i] = (char) r.nextInt();
}
keys[j] = new String(str);
}
populatedMap = new HashMap<>();
for (int i = 0; i < count; i++) {
populatedMap.put(keys[i], value);
}
populatedSortedStringArrayMap = new SortedArrayStringMap();
for (int i = 0; i < count; i++) {
populatedSortedStringArrayMap.putValue(keys[i], value);
}
populatedOpenHashContextData = new OpenHashStringMap<>();
for (int i = 0; i < count; i++) {
populatedOpenHashContextData.putValue(keys[i], value);
}
}
use of org.openjdk.jmh.annotations.Setup in project logging-log4j2 by apache.
the class FileAppenderBenchmark 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(FileAppenderBenchmark.class);
log4j2AsyncAppender = LogManager.getLogger("AsyncAppender");
log4j2AsyncDisruptor = LogManager.getLogger("AsyncDisruptorAppender");
log4j2AsyncLogger = LogManager.getLogger("AsyncLogger");
log4j2MemoryLogger = LogManager.getLogger("MemoryMapped");
log4j2RandomLogger = LogManager.getLogger("TestRandom");
slf4jLogger = LoggerFactory.getLogger(FileAppenderBenchmark.class);
slf4jAsyncLogger = LoggerFactory.getLogger("Async");
log4j1Logger = org.apache.log4j.Logger.getLogger(FileAppenderBenchmark.class);
julFileHandler = new FileHandler("target/testJulLog.log");
julLogger = java.util.logging.Logger.getLogger(getClass().getName());
julLogger.setUseParentHandlers(false);
julLogger.addHandler(julFileHandler);
julLogger.setLevel(Level.ALL);
}
Aggregations