forked from MeloNX/MeloNX
android - close file handles in performance monitor
This commit is contained in:
parent
29332c44ab
commit
0f1b737b07
@ -121,8 +121,6 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val freq = performanceMonitor.getFrequencies()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
@ -11,33 +11,9 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import java.io.RandomAccessFile
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class PerformanceMonitor {
|
||||
val numberOfCores = Runtime.getRuntime().availableProcessors()
|
||||
private var isMonitoring: Boolean = false
|
||||
fun startMonitoring() {
|
||||
if(isMonitoring)
|
||||
return
|
||||
|
||||
isMonitoring = true
|
||||
|
||||
thread {
|
||||
monitor()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun monitor(){
|
||||
while(isMonitoring) {
|
||||
//lastCpuUsages = HardwarePropertiesManager.
|
||||
|
||||
//Thread.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
fun getFrequencies() : List<Double> {
|
||||
val frequencies = mutableListOf<Double>()
|
||||
@ -49,6 +25,7 @@ class PerformanceMonitor {
|
||||
"r"
|
||||
)
|
||||
val f = reader.readLine()
|
||||
reader.close()
|
||||
freq = f.toDouble() / 1000.0
|
||||
}
|
||||
catch (e:Exception){
|
||||
|
Loading…
x
Reference in New Issue
Block a user