get_prefix = function()

in tools/pthtrace.lua [14:41]


get_prefix = function(buf)
    if initial_timestamp == 0 then
        initial_timestamp = buf.timestamp
    end
    local secs = trace.convert_timestamp_to_nanoseconds(buf.timestamp - initial_timestamp) / 1000000000

    local prefix
    if trace.debugid_is_start(buf.debugid) then
        prefix = "→"
    elseif trace.debugid_is_end(buf.debugid) then
        prefix = "←"
    else
        prefix = "↔"
    end

    local proc
    if buf.command ~= "kernel_task" then
        proc = buf.command
        workqueue_ptr_map[buf[1]] = buf.command
    elseif workqueue_ptr_map[buf[1]] ~= nil then
        proc = workqueue_ptr_map[buf[1]]
    else
        proc = "UNKNOWN"
    end

    return string.format("%s %6.9f %-17s [%05d.%06x] %-24s",
        prefix, secs, proc, buf.pid, buf.threadid, buf.debugname)
end