Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package com.facebook.systrace

import androidx.tracing.Trace
import kotlin.text.StringBuilder

/**
* Systrace stub that mostly does nothing but delegates to Trace for beginning/ending sections. The
Expand Down Expand Up @@ -35,6 +36,28 @@ public object Systrace {
Trace.beginSection(sectionName)
}

@JvmStatic
public fun beginSection(tag: Long, sectionName: String, args: Array<String>, argsLength: Int) {
Trace.beginSection(sectionName + "|" + convertArgsToText(args, argsLength))
}

private fun convertArgsToText(args: Array<String>, argsLength: Int): String {
val argsText: StringBuilder = StringBuilder()
var ii = 1
while (ii < argsLength) {
val key = args[ii - 1]
val value = args[ii]
argsText.append(key)
argsText.append('=')
argsText.append(value)
if (ii < argsLength - 1) {
argsText.append(';')
}
ii += 2
}
return argsText.toString()
}

@JvmStatic
public fun endSection(tag: Long) {
Trace.endSection()
Expand Down