Package org.agrona.agent
Class BufferAlignmentAgent
- java.lang.Object
-
- org.agrona.agent.BufferAlignmentAgent
-
public final class BufferAlignmentAgent extends java.lang.Object
A Java agent that verifies that all memory accesses inDirectBuffer
implementations are aligned.Unaligned accesses can be slower or even make the JVM crash on some architectures.
Using this agent will avoid such crashes, but it has a performance overhead and should only be used for testing and debugging.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BufferAlignmentAgent.AgentBuilderListener
-
Field Summary
Fields Modifier and Type Field Description private static net.bytebuddy.agent.builder.ResettableClassFileTransformer
alignmentTransformer
private static java.lang.instrument.Instrumentation
instrumentation
-
Constructor Summary
Constructors Modifier Constructor Description private
BufferAlignmentAgent()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
agent(boolean shouldRedefine, java.lang.instrument.Instrumentation instrumentation)
static void
agentmain(java.lang.String agentArgs, java.lang.instrument.Instrumentation instrumentation)
Invoked when the agent is attached to an already running application.static void
premain(java.lang.String agentArgs, java.lang.instrument.Instrumentation instrumentation)
Invoked when the agent is launched with the JVM and before the main application.static void
removeTransformer()
Remove the bytecode transformer and associated bytecode weaving so the alignment checks are not made.
-
-
-
Method Detail
-
premain
public static void premain(java.lang.String agentArgs, java.lang.instrument.Instrumentation instrumentation)
Invoked when the agent is launched with the JVM and before the main application.- Parameters:
agentArgs
- ignored for buffer alignment agent.instrumentation
- for adding bytecode to classes.
-
agentmain
public static void agentmain(java.lang.String agentArgs, java.lang.instrument.Instrumentation instrumentation)
Invoked when the agent is attached to an already running application.- Parameters:
agentArgs
- ignored for buffer alignment agent.instrumentation
- for adding bytecode to classes.
-
agent
private static void agent(boolean shouldRedefine, java.lang.instrument.Instrumentation instrumentation)
-
removeTransformer
public static void removeTransformer()
Remove the bytecode transformer and associated bytecode weaving so the alignment checks are not made.
-
-