use of java.lang.management.CompilationMXBean in project accumulo by apache.
the class TabletServerBatchWriter method addMutation.
public synchronized void addMutation(Table.ID table, Mutation m) throws MutationsRejectedException {
if (closed)
throw new IllegalStateException("Closed");
if (m.size() == 0)
throw new IllegalArgumentException("Can not add empty mutations");
checkForFailures();
waitRTE(new WaitCondition() {
@Override
public boolean shouldWait() {
return (totalMemUsed > maxMem || flushing) && !somethingFailed;
}
});
// do checks again since things could have changed while waiting and not holding lock
if (closed)
throw new IllegalStateException("Closed");
checkForFailures();
if (startTime == 0) {
startTime = System.currentTimeMillis();
List<GarbageCollectorMXBean> gcmBeans = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean garbageCollectorMXBean : gcmBeans) {
initialGCTimes += garbageCollectorMXBean.getCollectionTime();
}
CompilationMXBean compMxBean = ManagementFactory.getCompilationMXBean();
if (compMxBean.isCompilationTimeMonitoringSupported()) {
initialCompileTimes = compMxBean.getTotalCompilationTime();
}
initialSystemLoad = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();
}
// create a copy of mutation so that after this method returns the user
// is free to reuse the mutation object, like calling readFields... this
// is important for the case where a mutation is passed from map to reduce
// to batch writer... the map reduce code will keep passing the same mutation
// object into the reduce method
m = new Mutation(m);
totalMemUsed += m.estimatedMemoryUsed();
mutations.addMutation(table, m);
totalAdded++;
if (mutations.getMemoryUsed() >= maxMem / 2) {
startProcessing();
checkForFailures();
}
}
use of java.lang.management.CompilationMXBean in project neo4j by neo4j.
the class MetaSection method retrieve.
static Stream<RetrieveResult> retrieve(String graphToken, Kernel kernel, long numSilentQueryDrops) throws TransactionFailureException {
Map<String, Object> systemData = new HashMap<>();
systemData.put("jvmMemoryFree", Runtime.getRuntime().freeMemory());
systemData.put("jvmMemoryTotal", Runtime.getRuntime().totalMemory());
systemData.put("jvmMemoryMax", Runtime.getRuntime().maxMemory());
systemData.put("systemTotalPhysicalMemory", OsBeanUtil.getTotalPhysicalMemory());
systemData.put("systemFreePhysicalMemory", OsBeanUtil.getFreePhysicalMemory());
systemData.put("systemCommittedVirtualMemory", OsBeanUtil.getCommittedVirtualMemory());
systemData.put("systemTotalSwapSpace", OsBeanUtil.getTotalSwapSpace());
systemData.put("systemFreeSwapSpace", OsBeanUtil.getFreeSwapSpace());
OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
systemData.put("osArch", os.getArch());
systemData.put("osName", os.getName());
systemData.put("osVersion", os.getVersion());
systemData.put("availableProcessors", os.getAvailableProcessors());
systemData.put("byteOrder", ByteOrder.nativeOrder().toString());
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
systemData.put("jvmName", runtime.getVmName());
systemData.put("jvmVendor", runtime.getVmVendor());
systemData.put("jvmVersion", runtime.getVmVersion());
CompilationMXBean compiler = ManagementFactory.getCompilationMXBean();
systemData.put("jvmJITCompiler", compiler == null ? "unknown" : compiler.getName());
systemData.put("userLanguage", Locale.getDefault().getLanguage());
systemData.put("userCountry", Locale.getDefault().getCountry());
systemData.put("userTimezone", TimeZone.getDefault().getID());
systemData.put("fileEncoding", System.getProperty("file.encoding"));
Map<String, Object> internalData = new HashMap<>();
internalData.put("numSilentQueryCollectionMisses", numSilentQueryDrops);
Map<String, Object> metaData = new HashMap<>();
metaData.put("graphToken", graphToken);
metaData.put("retrieveTime", ZonedDateTime.now());
metaData.put("system", systemData);
metaData.put("internal", internalData);
TokensSection.putTokenCounts(metaData, kernel);
return Stream.of(new RetrieveResult(Sections.META, metaData));
}
use of java.lang.management.CompilationMXBean in project Payara by payara.
the class ClassReporter method getClassReport.
public String getClassReport() throws RuntimeException {
try {
final StringBuilderNewLineAppender sb = new StringBuilderNewLineAppender(new StringBuilder());
final ClassLoadingMXBean clmb = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.CLASS_LOADING_MXBEAN_NAME, ClassLoadingMXBean.class);
sb.append(sm.getString("classloading.info"));
sb.append(sm.getString("classes.loaded", clmb.getLoadedClassCount()));
sb.append(sm.getString("classes.total", clmb.getTotalLoadedClassCount()));
sb.append(sm.getString("classes.unloaded", clmb.getUnloadedClassCount()));
final CompilationMXBean cmb = ManagementFactory.newPlatformMXBeanProxy(mbsc, ManagementFactory.COMPILATION_MXBEAN_NAME, CompilationMXBean.class);
sb.append(sm.getString("complilation.info"));
sb.append(sm.getString("compilation.monitor.status", cmb.isCompilationTimeMonitoringSupported()));
sb.append(sm.getString("jit.compilar.name", cmb.getName()));
sb.append(sm.getString("compilation.time", JVMInformationCollector.millis2HoursMinutesSeconds(cmb.getTotalCompilationTime())));
return (sb.toString());
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
use of java.lang.management.CompilationMXBean in project karaf by apache.
the class EnvironmentDumpProvider method dumpVMInformation.
private void dumpVMInformation(final PrintWriter outPW, final DateFormat dateTimeFormatInstance) {
final RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean();
if (mxBean == null) {
return;
}
outPW.printf(KEY_VALUE_FORMAT, "Instance name", mxBean.getName()).println();
outPW.printf(KEY_VALUE_FORMAT, "Start time", dateTimeFormatInstance.format(new Date(mxBean.getStartTime()))).println();
outPW.printf(KEY_VALUE_FORMAT, "Uptime", printDuration(mxBean.getUptime())).println();
outPW.println();
outPW.printf(KEY_VALUE_FORMAT, "Java VM", mxBean.getVmName() + " " + mxBean.getVmVersion()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "vendor", mxBean.getVmVendor()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "version", System.getProperty("java.version")).println();
outPW.println();
outPW.println("Input arguments:");
final List<String> inputArguments = mxBean.getInputArguments();
for (final String argument : inputArguments) {
if (argument != null && argument.contains("=")) {
final String[] split = argument.split("=");
outPW.printf(INDENT_KEY_VALUE_FORMAT, split[0], split[1]).println();
} else {
outPW.printf(INDENT_KEY_VALUE_FORMAT, argument, "").println();
}
}
outPW.println("Classpath:");
outPW.printf(INDENT_KEY_VALUE_FORMAT, "boot classpath", mxBean.getBootClassPath()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "library path", mxBean.getLibraryPath()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "classpath", mxBean.getClassPath()).println();
outPW.println("System properties:");
final Map<String, String> systemProperties = mxBean.getSystemProperties();
for (final Entry<String, String> property : systemProperties.entrySet()) {
outPW.printf(INDENT_KEY_VALUE_FORMAT, property.getKey(), property.getValue()).println();
}
outPW.println();
// JIT information
final CompilationMXBean compilationMXBean = ManagementFactory.getCompilationMXBean();
if (compilationMXBean != null) {
outPW.printf(KEY_VALUE_FORMAT, "JIT compiler", compilationMXBean.getName()).println();
outPW.printf(INDENT_KEY_VALUE_FORMAT, "total compile time", printDuration(compilationMXBean.getTotalCompilationTime())).println();
}
}
use of java.lang.management.CompilationMXBean in project MyPerf4J by ThinkpadNC5.
the class JvmCompilationCollector method collectCompilationMetrics.
public static JvmCompilationMetrics collectCompilationMetrics() {
CompilationMXBean mxBean = COMPILATION_MX_BEAN;
if (mxBean != null && mxBean.isCompilationTimeMonitoringSupported()) {
long totalTime = mxBean.getTotalCompilationTime();
long timeInterval = totalTime - lastTime;
lastTime = totalTime;
return new JvmCompilationMetrics(timeInterval, totalTime);
}
return new JvmCompilationMetrics(0L, 0L);
}
Aggregations