public class ReflectionBenchmark extends Object
Benchmarks the different ways the caller class can be obtained. To run this in sampling mode (latency test):
java -jar benchmarks.jar ".*ReflectionBenchmark.*" -i 5 -f 1 -wi 5 -bm sample -tu ns
To run this in throughput testing mode:
java -jar benchmarks.jar ".*ReflectionBenchmark.*" -i 5 -f 1 -wi 5 -bm Throughput -tu ms
Modifier and Type | Class and Description |
---|---|
static class |
ReflectionBenchmark.ClassContextManager |
static class |
ReflectionBenchmark.RandomInteger |
Constructor and Description |
---|
ReflectionBenchmark() |
public void baseline()
public String test01_getCallerClassNameFromStackTrace()
public String test02_getCallerClassNameFromThreadStackTrace()
public String test03_getCallerClassNameReflectively()
public String test04_getCallerClassNameSunReflection()
public Class<?> test05_getStackTraceClassForClassName() throws ClassNotFoundException
ClassNotFoundException
public Class<?> test06_getThreadStackTraceClassForClassName() throws ClassNotFoundException
ClassNotFoundException
public Class<?> test07_getReflectiveCallerClassUtility()
public Class<?> test08_getDirectSunReflection()
public Message test09_getMessageUsingNew(ReflectionBenchmark.RandomInteger rng)
public Message test10_getMessageUsingReflection(ReflectionBenchmark.RandomInteger rng) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
public Class<?>[] test11_getClassContextViaCallerClass()
public Class<?>[] test12_getClassContextViaSecurityManager(ReflectionBenchmark.ClassContextManager classContextManager)
Copyright © 1999-2021 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.