public class BenchmarkCounters extends Object
DynamicCounterNode
s. The
infrastructure is enabled by specifying either the GenericDynamicCounters or
BenchmarkDynamicCounters option.
The counters are kept in a special area allocated for each native JavaThread object, and the
number of counters is configured using -XX:GraalCounterSize=value
.
-XX:+/-GraalCountersExcludeCompiler
configures whether to exclude compiler threads
(defaults to true).
The subsystems that use the logging need to have their own options to turn on the counters, and
insert DynamicCounterNodes when they're enabled.
Counters will be displayed as a rate (per second) if their group name starts with "~", otherwise
they will be displayed as a total number.
-XX:GraalCounterSize=value
. The actual required value depends on the granularity
of the profiling, 10000 should be enough for most cases.-XX:+/-GraalCountersExcludeCompiler
specifies whether the numbers generated by
compiler threads should be excluded (default: true)."-G:BenchmarkDynamicCounters=err, starting ====, PASSED in "
and
-G:+ProfileAllocations
.NewObjectSnippets.PROFILE_MODE
field.Modifier and Type | Class and Description |
---|---|
private static class |
BenchmarkCounters.CallbackOutputStream |
private static class |
BenchmarkCounters.Counter |
(package private) static class |
BenchmarkCounters.Options |
Modifier and Type | Field and Description |
---|---|
static ConcurrentHashMap<String,BenchmarkCounters.Counter> |
counterMap |
static long[] |
delta |
private static boolean |
DUMP_STATIC |
static boolean |
enabled |
Constructor and Description |
---|
BenchmarkCounters() |
Modifier and Type | Method and Description |
---|---|
private static void |
clear(long[] counters) |
private static void |
dump(PrintStream out,
double seconds,
long[] counters,
int maxRows) |
private static void |
dumpComputerReadable(PrintStream out,
boolean staticCounter,
String group,
long[] array,
Set<Map.Entry<String,BenchmarkCounters.Counter>> counterEntrySet) |
private static void |
dumpCounters(PrintStream out,
double seconds,
long[] counters,
boolean staticCounter,
String group,
int maxRows) |
private static void |
dumpHumanReadable(PrintStream out,
double seconds,
boolean staticCounter,
String group,
int maxRows,
long[] array,
Set<Map.Entry<String,BenchmarkCounters.Counter>> counterEntrySet) |
private static BenchmarkCounters.Counter |
getCounter(String name,
String group,
HotSpotVMConfig config) |
static int |
getIndex(String name,
String group,
HotSpotVMConfig config) |
static int |
getIndexConstantIncrement(String name,
String group,
HotSpotVMConfig config,
long increment) |
private static String |
getName(String nameGroup,
String group) |
static void |
initialize(CompilerToVM compilerToVM) |
private static long |
percentage(long counter,
long sum) |
static void |
shutdown(CompilerToVM compilerToVM,
long compilerStartTime) |
private static final boolean DUMP_STATIC
public static boolean enabled
public static final ConcurrentHashMap<String,BenchmarkCounters.Counter> counterMap
public static long[] delta
public BenchmarkCounters()
public static int getIndexConstantIncrement(String name, String group, HotSpotVMConfig config, long increment)
public static int getIndex(String name, String group, HotSpotVMConfig config)
private static BenchmarkCounters.Counter getCounter(String name, String group, HotSpotVMConfig config) throws JVMCIError
JVMCIError
private static void dump(PrintStream out, double seconds, long[] counters, int maxRows)
private static void clear(long[] counters)
private static void dumpCounters(PrintStream out, double seconds, long[] counters, boolean staticCounter, String group, int maxRows)
private static void dumpHumanReadable(PrintStream out, double seconds, boolean staticCounter, String group, int maxRows, long[] array, Set<Map.Entry<String,BenchmarkCounters.Counter>> counterEntrySet)
private static void dumpComputerReadable(PrintStream out, boolean staticCounter, String group, long[] array, Set<Map.Entry<String,BenchmarkCounters.Counter>> counterEntrySet)
private static long percentage(long counter, long sum)
public static void initialize(CompilerToVM compilerToVM)
public static void shutdown(CompilerToVM compilerToVM, long compilerStartTime)