return ERT.box(ERT.asyncThreadPoolSize());
} else if (type == am_break_ignored) {
return ERT.box(false);
} else if (type == am_compat_rel) {
// we return same value as R14
return new ESmall(14);
}
ETuple2 tup;
if (type == am_allocated_areas) {
ECons res = ERT.NIL;
List<MemoryPoolMXBean> bean2 = ManagementFactory
.getMemoryPoolMXBeans();
if (bean2 == null) {
MemoryMXBean bean = ManagementFactory.getMemoryMXBean();
if (bean != null) {
MemoryUsage mu = bean.getHeapMemoryUsage();
res = res.cons(ETuple.make(am_heap, ERT.box(mu.getCommitted()),
ERT.box(mu.getUsed())));
mu = bean.getNonHeapMemoryUsage();
res = res.cons(ETuple.make(am_non_heap, ERT.box(mu
.getCommitted()), ERT.box(mu.getUsed())));
}
return res;
}
for (MemoryPoolMXBean mb : bean2) {
String name = mb.getName();
MemoryUsage mu = mb.getUsage();
if (mu == null) continue;
String name2 = (mb.getType()==MemoryType.HEAP ? "heap:" : "non_heap:" ) + name;
res = res.cons(ETuple.make(EAtom.intern(name2), ERT.box(mu
.getCommitted()), ERT.box(mu.getUsed())));
}
return res;
} else if (type == am_allocator) {
return am_jvm;
} else if (type == am_heap_type) {
return am_shared;
} else if (type == am_smp_support) {
return ERT.TRUE;
} else if (type == am_thread_pool_size) {
// TODO: hook up to thread pool
return new ESmall(ERT.threadPoolSize());
} else if (type == am_os_type) {
String os = System.getProperty("os.name");
if (os.startsWith("Windows")) {
return ETuple.make(am_win32, new EString(os));
} else {
return ETuple.make(am_unix, new EString(os));
}
} else if (type == am_threads) {
return ERT.TRUE;
} else if (type == am_version) {
String erts_version = ERT.runtime_info.erts_version;
// remove prefix
String prefix = "erts-";
if (erts_version.startsWith(prefix)) {
erts_version = erts_version.substring(prefix.length());
}
return EString.fromString(erts_version);
} else if (type == am_otp_release) {
return new EString(ERT.runtime_info.otp_version);
} else if (type == am_logical_processors) {
// TODO: be smarter somehow
return ERT.box(Runtime.getRuntime().availableProcessors());
} else if (type == am_global_heaps_size) {
return ERT.box(Runtime.getRuntime().totalMemory());
} else if (type == am_process_count) {
return ERT.box(EProc.process_count());
} else if (type == am_system_architecture) {
return new EString(Main.SYSTEM_ARCHITECTURE);
} else if (type == am_driver_version) {
// TODO: be smarter somehow
return new EString(Main.DRIVER_VERSION);
} else if (type == am_wordsize) {
return new ESmall(4);
} else if (type == am_debug_compiled || type == am_lock_checking) {
throw ERT.badarg(type);
} else if (type == am_hipe_architecture) {