Commit 1a322d58 authored by Teng Qin's avatar Teng Qin

Improve trace.py print format

parent 569461de
...@@ -485,13 +485,13 @@ BPF_PERF_OUTPUT(%s); ...@@ -485,13 +485,13 @@ BPF_PERF_OUTPUT(%s);
range(0, len(self.values))) range(0, len(self.values)))
msg = self._format_message(bpf, event.tgid, values) msg = self._format_message(bpf, event.tgid, values)
if not Probe.print_time: if not Probe.print_time:
print("%-6d %-6d %-12s %-16s %s" % print("%-7d %-7d %-15s %-16s %s" %
(event.tgid, event.pid, event.comm.decode(), (event.tgid, event.pid, event.comm.decode(),
self._display_function(), msg)) self._display_function(), msg))
else: else:
time = strftime("%H:%M:%S") if Probe.use_localtime else \ time = strftime("%H:%M:%S") if Probe.use_localtime else \
Probe._time_off_str(event.timestamp_ns) Probe._time_off_str(event.timestamp_ns)
print("%-8s %-6d %-6d %-12s %-16s %s" % print("%-8s %-7d %-7d %-15s %-16s %s" %
(time[:8], event.tgid, event.pid, (time[:8], event.tgid, event.pid,
event.comm.decode(), self._display_function(), msg)) event.comm.decode(), self._display_function(), msg))
...@@ -685,11 +685,11 @@ trace -I 'kernel/sched/sched.h' \\ ...@@ -685,11 +685,11 @@ trace -I 'kernel/sched/sched.h' \\
# Print header # Print header
if self.args.timestamp or self.args.time: if self.args.timestamp or self.args.time:
print("%-8s %-6s %-6s %-12s %-16s %s" % print("%-8s %-7s %-7s %-15s %-16s %s" %
("TIME", "PID", "TID", "COMM", "FUNC", ("TIME", "PID", "TID", "COMM", "FUNC",
"-" if not all_probes_trivial else "")) "-" if not all_probes_trivial else ""))
else: else:
print("%-6s %-6s %-12s %-16s %s" % print("%-7s %-7s %-15s %-16s %s" %
("PID", "TID", "COMM", "FUNC", ("PID", "TID", "COMM", "FUNC",
"-" if not all_probes_trivial else "")) "-" if not all_probes_trivial else ""))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment