Skip to content

Commit

Permalink
Android: Implement RAM usage counter into FPS counter
Browse files Browse the repository at this point in the history
Also fixing a typo that causes android build to fail
  • Loading branch information
Ishan09811 authored and Gamer64ytb committed Jul 26, 2024
1 parent bf6691d commit e9673fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import org.citra.citra_emu.utils.EmulationLifecycleUtil
import org.citra.citra_emu.utils.Log
import org.citra.citra_emu.utils.ViewUtils
import org.citra.citra_emu.viewmodel.EmulationViewModel
import java.io.File

class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.FrameCallback {
private val preferences: SharedPreferences
Expand Down Expand Up @@ -1017,14 +1018,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
val SPEED = 3
perfStatsUpdater = Runnable {
val perfStats = NativeLibrary.getPerfStats()
val ramUsage = File("/proc/self/statm").readLines()[0].split(' ')[1].toLong() * 4096 / 1000000
val ramUsageText = "RAM USAGE: " + ramUsage + " MB"
if (perfStats[FPS] > 0) {
binding.showFpsText.text = String.format(
"FPS: %d Speed: %d%%",
(perfStats[FPS] + 0.5).toInt(),
(perfStats[SPEED] * 100.0 + 0.5).toInt()
)
binding.showFpsText.text = String.format("FPS: %d Speed: %d%%\n%s", (perfStats[FPS] + 0.5).toInt(), (perfStats[SPEED] * 100.0 + 0.5).toInt(), ramUsageText)
}
perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 3000)
perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 800)
}
perfStatsUpdateHandler.post(perfStatsUpdater!!)
binding.showFpsText.visibility = View.VISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import coil.key.Keyer
import coil.memory.MemoryCache
import coil.request.ImageRequest
import coil.request.Options
import coil.transform.RoundedCornersTransformation
import org.citra.citra_emu.R
import org.citra.citra_emu.model.Game
import java.nio.IntBuffer
Expand Down

0 comments on commit e9673fa

Please sign in to comment.