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)
}
})

Functions

Link copied to clipboard
fun instant(pid: Int, tid: Int, category: String, name: String, atNanos: Long, args: Map<String, String>): String

An instant event (phase i) on its thread's track, at a time in microseconds.

Link copied to clipboard
fun span(pid: Int, tid: Int, category: String, name: String, beginNanos: Long, endNanos: Long, args: Map<String, String>): String

A complete event (phase X): a begin time and a duration, both in microseconds.