public class PerfCakeAgent extends Object
Starts a thread with a socket server listening on a specified host and port and is used by PerfCake's reporting (class org.perfcake.reporting.reporters.MemoryUsageReporter) to gather memory usage data and to control garbage collection and heap dump activities needed by the reporter.
To attach the agent to the tested system's JVM, append the following JVM argument to the executing java command or use JAVA_OPTS environment variable:
"... -javaagent:<perfcake_jar_path>=hostname=<hostname>,port=<port>
where perfcake_jar_path is a path to PerfCake JAR archive, hostname and port
specifies agent's socket.
| Command | Description |
|---|---|
"FREE" |
Returns the amount of free memory in the Java Virtual Machine. |
"USED" |
Returns the amount of used memory in the Java Virtual Machine. |
"TOTAL" |
Returns the amount of total memory in the Java Virtual Machine. |
"MAX" |
Returns the maximum amount of memory that the Java Virtual Machine will attempt to use. |
"DUMP(:<dump-file>)" |
Initiates a heap dump into dump-file. dump-file is optional - if not provided,
the file name would be generated as "dump-" + . |
"GC" |
Calls System.gc(). |
AgentCommand| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_ENCODING
Default encoding of the input and output streams.
|
static int |
DEFAULT_PORT
Default agent port.
|
| Constructor and Description |
|---|
PerfCakeAgent() |
| Modifier and Type | Method and Description |
|---|---|
static void |
premain(String agentArgs)
PerfCakeAgent's pre-main method. |
public static final String DEFAULT_ENCODING
public static final int DEFAULT_PORT
public static void premain(String agentArgs)
PerfCakeAgent's pre-main method.agentArgs - Agent arguments.java.lang.instrumentCopyright © 2010–2015 PerfCake Community. All rights reserved.