lttng/Babeltrace: Compressing/reducing output/sampled data

34 Views Asked by At

We need to gather kernel trace data from Linux. This works really well, but there is redundant resp. unneeded data in every record. This is a typical output line as decoded by babletrace:

[00:04:37.508041806] (+0.000008755) MACHINE_NAME sched_waking: { cpu_id = 0 }, { comm = "mythread1", tid = 1149, prio = 20, target_cpu = 0 }

The machine name bears no additional information as there is only one machine so the name is the same in every record. Likewise the cpu id as there is only one cpu in our setup.

As these traces tend to become huge (we are easily talking 100M trace files for only a very few seconds of tracing), we want to reduce the output as much as possible, ideally already on the lttng sampling level, or in the babeltrace decoding phase.

Thank you for all input!

I found that adding fields appears to be possible using the lttng add-context command, but there does not appear to be a corresponding option to suppress default fields.

I also attempted to use the -v, -vv and -vvv options with lttng, but there is no perceivable difference in what it does, at least with respect to the decoded traces.

I also found that adding the --fields trace:domain option to babeltrace will replace MACHINE_NAME with kernel which helps a little but still has a lot of reduncancy in it.

EDIT: I was able to get close to what I want with the following command:

babeltrace /tmp/my-kernel-trace | sed -e 's/ MY_MACHINE //' -e 's/ { cpu_id = 0 },//' -e 's/comm =//'

but a preferrable solution would be to prevent those fields to go into the trace in the first place

0

There are 0 best solutions below