X-Git-Url: https://git.saurik.com/apple/system_cmds.git/blobdiff_plain/1a7e3f61d38d679bba59130891c2031b5a0092b6..bd6521f0fc816ab056bc71376f9706a69b3b52c1:/kdprof/EventPrinting.cpp diff --git a/kdprof/EventPrinting.cpp b/kdprof/EventPrinting.cpp new file mode 100644 index 0000000..c2f5f61 --- /dev/null +++ b/kdprof/EventPrinting.cpp @@ -0,0 +1,31 @@ +// +// EventPrinting.cpp +// kdprof +// +// Created by James McIlree on 6/6/13. +// Copyright (c) 2013 Apple. All rights reserved. +// + +#include "global.h" + +void print_event_header(const Globals& globals, bool is_64_bit) { + + // Header is... + // + // [Index] Time Type Code arg1 arg2 arg3 arg4 thread cpu# command/IOP-name pid + // 8 16 4 34 8/16 8/16 8/16 8/16 10 4 16 6 + + + if (globals.should_print_event_index()) + dprintf(globals.output_fd(), "%8s ", "Event#"); + + // The character counting for "Time(µS)" is OBO, it treats the µ as two characters. + // This means the %16s misaligns. We force it by making the input string 16 printable chars long, + // which overflows the %16s to the correct actual output length. + const char* time = globals.should_print_mach_absolute_timestamps() ? "Time(mach-abs)" : " Time(µS)"; + + if (is_64_bit) + dprintf(globals.output_fd(), "%16s %4s %-34s %-16s %-16s %-16s %-16s %10s %4s %-16s %-6s\n", time, "Type", "Code", "arg1", "arg2", "arg3", "arg4", "thread", "cpu#", "command", "pid"); + else + dprintf(globals.output_fd(), "%16s %4s %-34s %-8s %-8s %-8s %-8s %10s %4s %-16s %-6s\n", time, "Type", "Code", "arg1", "arg2", "arg3", "arg4", "thread", "cpu#", "command", "pid"); +}