ChromeTraceFormat
object ChromeTraceFormat
One trace event as one line of JSON, in the Chrome trace event format that Chrome's trace viewer and Perfetto open.
A file of them is a JSON array: write [, then the lines joined by commas, then ]. The process and thread ids are the caller's to choose, because KiteTrace.Sink carries neither.
KiteTrace.install(object : KiteTrace.Sink {
override fun span(category: String, name: String, beginNanos: Long, endNanos: Long, args: Map<String, String>) {
lines += ChromeTraceFormat.span(1, 1, category, name, beginNanos, endNanos, args)
}
override fun instant(category: String, name: String, atNanos: Long, args: Map<String, String>) {
lines += ChromeTraceFormat.instant(1, 1, category, name, atNanos, args)
}
})Content copied to clipboard