add stats entries for Bluetooth send/receive

This commit is contained in:
Eric House 2024-09-21 22:07:35 -07:00
parent 2a8a9b442a
commit 5504ca03d9
4 changed files with 21 additions and 11 deletions

View file

@ -32,17 +32,6 @@ import android.os.Build
import android.provider.Settings
import android.text.TextUtils
import org.eehouse.android.xw4.DbgUtils.DeadlockWatch
import org.eehouse.android.xw4.MultiService.DictFetchOwner
import org.eehouse.android.xw4.MultiService.MultiEvent
import org.eehouse.android.xw4.Perms23.Perm
import org.eehouse.android.xw4.TimerReceiver.TimerCallback
import org.eehouse.android.xw4.XWServiceHelper.ReceiveResult
import org.eehouse.android.xw4.jni.CommsAddrRec
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType
import org.eehouse.android.xw4.jni.CommsAddrRec.ConnExpl
import org.eehouse.android.xw4.jni.XwJNI
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.Closeable
@ -56,6 +45,18 @@ import java.util.concurrent.atomic.AtomicReference
import kotlin.concurrent.Volatile
import kotlin.math.min
import org.eehouse.android.xw4.DbgUtils.DeadlockWatch
import org.eehouse.android.xw4.MultiService.DictFetchOwner
import org.eehouse.android.xw4.MultiService.MultiEvent
import org.eehouse.android.xw4.Perms23.Perm
import org.eehouse.android.xw4.TimerReceiver.TimerCallback
import org.eehouse.android.xw4.XWServiceHelper.ReceiveResult
import org.eehouse.android.xw4.jni.CommsAddrRec
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType
import org.eehouse.android.xw4.jni.CommsAddrRec.ConnExpl
import org.eehouse.android.xw4.jni.XwJNI
import org.eehouse.android.xw4.jni.XwJNI.STAT
object BTUtils {
private val TAG: String = BTUtils::class.java.simpleName
private const val BOGUS_MARSHMALLOW_ADDR = "02:00:00:00:00:00"
@ -988,6 +989,7 @@ object BTUtils {
msgCount, data.size, Utils.getMD5SumFor(data),
this
)
XwJNI.sts_increment(STAT.STAT_BT_SENT);
} catch (ioe: IOException) {
Log.e(TAG, "writeAndCheck(): ioe: %s", ioe.message)
localElems = null
@ -1408,6 +1410,8 @@ object BTUtils {
data.size, Utils.getMD5SumFor(data), nMessages
)
XwJNI.sts_increment(STAT.STAT_BT_RCVD);
for (ii in 0 until nMessages) {
val cmdOrd = dis.readByte()
val oneLen = if (isOldProto) 0 else dis.readShort() // used only to skip

View file

@ -219,6 +219,8 @@ class XwJNI private constructor() {
STAT_NBS_RCVD,
STAT_NBS_SENT,
STAT_BT_RCVD,
STAT_BT_SENT,
STAT_NSTATS,
}

View file

@ -142,6 +142,8 @@ STATtoStr(STAT stat)
CASESTR(STAT_NEW_REMATCH);
CASESTR(STAT_NBS_SENT);
CASESTR(STAT_NBS_RCVD);
CASESTR(STAT_BT_SENT);
CASESTR(STAT_BT_RCVD);
default:
XP_ASSERT(0);
}

View file

@ -40,6 +40,8 @@ typedef enum {
STAT_NBS_RCVD,
STAT_NBS_SENT,
STAT_BT_RCVD,
STAT_BT_SENT,
STAT_NSTATS,
} STAT;