Skip to content

Commit

Permalink
show who is calling tox save
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Oct 15, 2023
1 parent 07e3c7d commit 72e2205
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/kotlin/com/zoffcc/applications/trifa/HelperGeneric.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@ package com.zoffcc.applications.trifa

import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.loadImageBitmap
import androidx.compose.runtime.getValue
import androidx.compose.runtime.produceState
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.loadImageBitmap
import androidx.compose.ui.res.loadSvgPainter
import androidx.compose.ui.res.loadXmlImageVector
import androidx.compose.ui.unit.Density
import com.zoffcc.applications.trifa.MainActivity.Companion.update_savedata_file
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.xml.sax.InputSource
import java.io.BufferedInputStream
import java.io.File
import java.io.IOException
import java.nio.ByteBuffer
import java.nio.charset.StandardCharsets
import kotlin.reflect.KFunction1

object HelperGeneric {
private const val TAG = "trifa.Hlp.Generic"
Expand Down Expand Up @@ -90,14 +88,23 @@ object HelperGeneric {
}

fun update_savedata_file_wrapper() {
var callerMethodName = ""
try {
val stacktrace = Thread.currentThread().stackTrace
val e = stacktrace[2]
callerMethodName = " called from:" + e.methodName
} catch (e: Exception) {
e.printStackTrace()
}

try {
MainActivity.semaphore_tox_savedata!!.acquire()
val password_hash_2 = MainActivity.password_hash
val start_timestamp = System.currentTimeMillis()
update_savedata_file(password_hash_2)
val end_timestamp = System.currentTimeMillis()
MainActivity.semaphore_tox_savedata!!.release()
Log.i(TAG, "update_savedata_file() took:" + (end_timestamp - start_timestamp).toFloat() / 1000f + "s")
Log.i(TAG, "update_savedata_file()" + callerMethodName + " took:" + (end_timestamp - start_timestamp).toFloat() / 1000f + "s")
} catch (e: InterruptedException) {
MainActivity.semaphore_tox_savedata!!.release()
e.printStackTrace()
Expand Down

0 comments on commit 72e2205

Please sign in to comment.