Session logs: record clocks, thermal status and battery temperature in every session

ClockLogComponent was only created inside startVkBridge(), so it never ran
on Adreno. Create it for every session (clocks.log, was vkbridge-clocks.log)
and append the battery temperature from ACTION_BATTERY_CHANGED to each
sample.

Part 1 of #1837.
This commit is contained in:
angelrenefm authored and Kurt Himebauch committed 2026-11-05 14:00:30 -05:00
1 parent baf7d90df9
commit 5805631be5
3 files changed
+45 -4

No files matched your search

@@ -1,6 +1,9 @@
package com.droiddeck.launcher.gpu
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import android.os.Build
import android.os.PowerManager
import android.util.Log
@@ -65,6 +68,7 @@ class ClockLogComponent(private val logFile: File) : SessionPart() {
if (!h.isNaN()) line.append(String.format(Locale.US, " headroom %.2f", h))
}
}
batteryTenths()?.let { line.append(String.format(Locale.US, " | battery %.1f C", it / 10.0)) }
w.write(line.append('\n').toString())
w.flush()
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
@@ -75,6 +79,10 @@ class ClockLogComponent(private val logFile: File) : SessionPart() {
}
}
private fun batteryTenths(): Int? =
app().registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
?.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, Int.MIN_VALUE)?.takeIf { it != Int.MIN_VALUE }
companion object {
private const val TAG = "SessionService"
private const val PERIOD_MS = 2000L
@@ -524,6 +524,10 @@ class SessionService : Service() {
guest.add("BL_VENC_SOCKET=" + encoder.socket.absolutePath)
}
startVkBridge(guest, sessionDir)
com.droiddeck.launcher.gpu.ClockLogComponent(File(sessionDir, "clocks.log")).let {
it.attach(this)
components.add(it)
}
guest.add("BL_WIDTH=" + size.first)
guest.add("BL_HEIGHT=" + size.second)
@@ -883,10 +887,6 @@ class SessionService : Service() {
val bridge = com.droiddeck.launcher.gpu.VkBridgeComponent(socket, File(sessionDir, "vkbridge-server.log"))
bridge.attach(this)
components.add(bridge)
com.droiddeck.launcher.gpu.ClockLogComponent(File(sessionDir, "vkbridge-clocks.log")).let {
it.attach(this)
components.add(it)
}
guest.add("BL_VKBRIDGE=1")
guest.add("VKBRIDGE_SOCKET=" + socket.path)
guest.add("VKBRIDGE_CLIENT_LOG=" + File(sessionDir, "vkbridge-client.log").path)