ClassFileTransformer
public class AllocationInstrumenter extends Object implements ClassFileTransformer
Modifier and Type | Method | Description |
---|---|---|
static byte[] |
instrument(byte[] originalBytes,
ClassLoader loader) |
|
static byte[] |
instrument(byte[] originalBytes,
String recorderClass,
String recorderMethod,
ClassLoader loader) |
Given the bytes representing a class, go through all the bytecode in it and
instrument any occurrences of new/newarray/anewarray/multianewarray with
pre- and post-allocation hooks.
|
static void |
premain(String agentArgs,
Instrumentation inst) |
|
byte[] |
transform(ClassLoader loader,
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] origBytes) |
transform
public static void premain(String agentArgs, Instrumentation inst)
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] origBytes)
transform
in interface ClassFileTransformer
public static byte[] instrument(byte[] originalBytes, String recorderClass, String recorderMethod, ClassLoader loader)
originalBytes
- the original byte[]
code.recorderClass
- the String
internal name of the class
containing the recorder method to run.recorderMethod
- the String
name of the recorder method
to run.loader
- the ClassLoader
for this class.byte[]
code.public static byte[] instrument(byte[] originalBytes, ClassLoader loader)
originalBytes
- The original version of the class.loader
- The ClassLoader of this class.documentation for the 4-arg version. This is a convenience
version that uses the recorder in this class.
Copyright © 2009–2018 Google, Inc.. All rights reserved.