Android 获取系统的一些信息
/*当前进程最大内存,-xmx/
javaHeap.max = Runtime.getRuntime().maxMemory()
/*当前进程初始化申请的内存,-xms/
javaHeap.total = Runtime.getRuntime().totalMemory()
/*当前进程剩余可用内存/
javaHeap.free = Runtime.getRuntime().freeMemory()
从系统的配置文件获取信息
kotlin.runCatching {
BufferedReader(InputStreamReader(FileInputStream(File("/proc/self/status")),Charsets.UTF_8)).forEachLine {
Log.d("系统配置文件","/proc/self/status: $it")
}
}.onFailure {
it.printStackTrace()
}
kotlin.runCatching {
BufferedReader(InputStreamReader(FileInputStream(File("/proc/meminfo")),Charsets.UTF_8)).forEachLine {
Log.d("系统配置文件","/proc/meminfo: $it")
}
}.onFailure {
it.printStackTrace()
}