mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-15 08:47:56 +01:00
add stats entries for Bluetooth send/receive
This commit is contained in:
parent
2a8a9b442a
commit
5504ca03d9
4 changed files with 21 additions and 11 deletions
|
@ -32,17 +32,6 @@ import android.os.Build
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.text.TextUtils
|
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.ByteArrayInputStream
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
|
@ -56,6 +45,18 @@ import java.util.concurrent.atomic.AtomicReference
|
||||||
import kotlin.concurrent.Volatile
|
import kotlin.concurrent.Volatile
|
||||||
import kotlin.math.min
|
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 {
|
object BTUtils {
|
||||||
private val TAG: String = BTUtils::class.java.simpleName
|
private val TAG: String = BTUtils::class.java.simpleName
|
||||||
private const val BOGUS_MARSHMALLOW_ADDR = "02:00:00:00:00:00"
|
private const val BOGUS_MARSHMALLOW_ADDR = "02:00:00:00:00:00"
|
||||||
|
@ -988,6 +989,7 @@ object BTUtils {
|
||||||
msgCount, data.size, Utils.getMD5SumFor(data),
|
msgCount, data.size, Utils.getMD5SumFor(data),
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
XwJNI.sts_increment(STAT.STAT_BT_SENT);
|
||||||
} catch (ioe: IOException) {
|
} catch (ioe: IOException) {
|
||||||
Log.e(TAG, "writeAndCheck(): ioe: %s", ioe.message)
|
Log.e(TAG, "writeAndCheck(): ioe: %s", ioe.message)
|
||||||
localElems = null
|
localElems = null
|
||||||
|
@ -1408,6 +1410,8 @@ object BTUtils {
|
||||||
data.size, Utils.getMD5SumFor(data), nMessages
|
data.size, Utils.getMD5SumFor(data), nMessages
|
||||||
)
|
)
|
||||||
|
|
||||||
|
XwJNI.sts_increment(STAT.STAT_BT_RCVD);
|
||||||
|
|
||||||
for (ii in 0 until nMessages) {
|
for (ii in 0 until nMessages) {
|
||||||
val cmdOrd = dis.readByte()
|
val cmdOrd = dis.readByte()
|
||||||
val oneLen = if (isOldProto) 0 else dis.readShort() // used only to skip
|
val oneLen = if (isOldProto) 0 else dis.readShort() // used only to skip
|
||||||
|
|
|
@ -219,6 +219,8 @@ class XwJNI private constructor() {
|
||||||
|
|
||||||
STAT_NBS_RCVD,
|
STAT_NBS_RCVD,
|
||||||
STAT_NBS_SENT,
|
STAT_NBS_SENT,
|
||||||
|
STAT_BT_RCVD,
|
||||||
|
STAT_BT_SENT,
|
||||||
|
|
||||||
STAT_NSTATS,
|
STAT_NSTATS,
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,8 @@ STATtoStr(STAT stat)
|
||||||
CASESTR(STAT_NEW_REMATCH);
|
CASESTR(STAT_NEW_REMATCH);
|
||||||
CASESTR(STAT_NBS_SENT);
|
CASESTR(STAT_NBS_SENT);
|
||||||
CASESTR(STAT_NBS_RCVD);
|
CASESTR(STAT_NBS_RCVD);
|
||||||
|
CASESTR(STAT_BT_SENT);
|
||||||
|
CASESTR(STAT_BT_RCVD);
|
||||||
default:
|
default:
|
||||||
XP_ASSERT(0);
|
XP_ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ typedef enum {
|
||||||
|
|
||||||
STAT_NBS_RCVD,
|
STAT_NBS_RCVD,
|
||||||
STAT_NBS_SENT,
|
STAT_NBS_SENT,
|
||||||
|
STAT_BT_RCVD,
|
||||||
|
STAT_BT_SENT,
|
||||||
|
|
||||||
STAT_NSTATS,
|
STAT_NSTATS,
|
||||||
} STAT;
|
} STAT;
|
||||||
|
|
Loading…
Add table
Reference in a new issue