Loading tracinglib/core/common/src/coroutines/TraceData.kt +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ internal class TraceData( */ internal fun endAllOnThread() { strictModeCheck() repeat(openSliceCount.get()) { endSlice() } repeat(openSliceCount.get() ?: 0) { endSlice() } openSliceCount.set(0) } Loading tracinglib/core/host/src-fake/TraceProxy.fake.kt +6 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ const val DEBUG = false /** Log a message with a tag indicating the current thread ID */ private fun debug(message: String) { if (DEBUG) println("Thread #${Thread.currentThread().id}: $message") if (DEBUG) println("Thread #${currentThreadId()}: $message") } private var isTracingEnabled = true Loading @@ -47,7 +47,7 @@ object FakeTraceState { private val allThreadStates = hashMapOf<Long, MutableList<String>>() fun begin(sectionName: String) { val threadId = Thread.currentThread().id val threadId = currentThreadId() synchronized(allThreadStates) { if (allThreadStates.containsKey(threadId)) { allThreadStates[threadId]!!.add(sectionName) Loading @@ -58,7 +58,7 @@ object FakeTraceState { } fun end() { val threadId = Thread.currentThread().id val threadId = currentThreadId() synchronized(allThreadStates) { assertFalse( "Attempting to close trace section on thread=$threadId, " + Loading @@ -71,7 +71,7 @@ object FakeTraceState { } fun getOpenTraceSectionsOnCurrentThread(): Array<String> { val threadId = Thread.currentThread().id val threadId = currentThreadId() synchronized(allThreadStates) { return allThreadStates[threadId]?.toTypedArray() ?: emptyArray() } Loading Loading @@ -129,3 +129,5 @@ internal actual fun instant(eventName: String) { internal actual fun instantForTrack(trackName: String, eventName: String) { debug("instantForTrack: track=$trackName name=$eventName") } private fun currentThreadId(): Long = Thread.currentThread().threadId() tracinglib/core/host/test/ExampleClass.kt +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ class ExampleClass( private val incrementCounter: suspend () -> Unit, ) { suspend fun classMethod(value: Int) { value.inc() // <-- suppress warning that parameter 'value' is unused testBase.expect( "launch-for-collect", "com.android.app.tracing.coroutines.FlowTracingTest\$stateFlowCollection$1\$collectJob$1$3:collect", Loading Loading
tracinglib/core/common/src/coroutines/TraceData.kt +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ internal class TraceData( */ internal fun endAllOnThread() { strictModeCheck() repeat(openSliceCount.get()) { endSlice() } repeat(openSliceCount.get() ?: 0) { endSlice() } openSliceCount.set(0) } Loading
tracinglib/core/host/src-fake/TraceProxy.fake.kt +6 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ const val DEBUG = false /** Log a message with a tag indicating the current thread ID */ private fun debug(message: String) { if (DEBUG) println("Thread #${Thread.currentThread().id}: $message") if (DEBUG) println("Thread #${currentThreadId()}: $message") } private var isTracingEnabled = true Loading @@ -47,7 +47,7 @@ object FakeTraceState { private val allThreadStates = hashMapOf<Long, MutableList<String>>() fun begin(sectionName: String) { val threadId = Thread.currentThread().id val threadId = currentThreadId() synchronized(allThreadStates) { if (allThreadStates.containsKey(threadId)) { allThreadStates[threadId]!!.add(sectionName) Loading @@ -58,7 +58,7 @@ object FakeTraceState { } fun end() { val threadId = Thread.currentThread().id val threadId = currentThreadId() synchronized(allThreadStates) { assertFalse( "Attempting to close trace section on thread=$threadId, " + Loading @@ -71,7 +71,7 @@ object FakeTraceState { } fun getOpenTraceSectionsOnCurrentThread(): Array<String> { val threadId = Thread.currentThread().id val threadId = currentThreadId() synchronized(allThreadStates) { return allThreadStates[threadId]?.toTypedArray() ?: emptyArray() } Loading Loading @@ -129,3 +129,5 @@ internal actual fun instant(eventName: String) { internal actual fun instantForTrack(trackName: String, eventName: String) { debug("instantForTrack: track=$trackName name=$eventName") } private fun currentThreadId(): Long = Thread.currentThread().threadId()
tracinglib/core/host/test/ExampleClass.kt +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ class ExampleClass( private val incrementCounter: suspend () -> Unit, ) { suspend fun classMethod(value: Int) { value.inc() // <-- suppress warning that parameter 'value' is unused testBase.expect( "launch-for-collect", "com.android.app.tracing.coroutines.FlowTracingTest\$stateFlowCollection$1\$collectJob$1$3:collect", Loading