Skip to contentSkip to conversation

trace-cmd report: Have --align-ts ignore empty CPU buffers

PATCH New Steven Rostedt 1 participant 1 message May 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd report: Have --align-ts ignore empty CPU buffers

From: "Steven Rostedt (VMware)" <[email protected]>

When testing out the trace-cmd report --align-ts, I saw no difference. And that was because one of the CPUs were empty.

Have the --align-ts option ignore empty CPUs.

---
Based on top of: https://lore.kernel.org/linux-trace-devel/[email protected]/

 lib/trace-cmd/trace-input.c | 3 +++
 1 file changed, 3 insertions(+)
lib/trace-cmd/trace-input.c +3 -0
index 4d5940d8..9726e994 100644
@@ -4089,6 +4089,9 @@ unsigned long long tracecmd_get_first_ts(struct tracecmd_input *handle)
 	int i;
 
 	for (i = 0; i < handle->cpus; i++) {
+		/* Ignore empty buffers */
+		if (!handle->cpu_data[i].size)
+			continue;
 		if (first || ts > handle->cpu_data[i].first_ts)
 			ts = handle->cpu_data[i].first_ts;
 		first = false;
Signature · 1 line
2.29.2