- /*
- * first entry, always ok
- */
- if (!expected_sequence)
- return 0;
+ if (!expected_sequence) {
+ struct rb_node *n;
+ char *cpu_seen;
+ int cpus;
+
+ /*
+ * 1 should be the first entry, just allow it
+ */
+ if (bit->sequence == 1)
+ return 0;
+
+ /*
+ * if we are starting somewhere else, check that we have
+ * entries from all cpus in the tree before dumping one
+ */
+ cpu_seen = malloc(pdi->nopenfiles);
+ n = rb_first(&rb_sort_root);
+ cpus = 0;
+ while (n) {
+ __t = rb_entry(n, struct trace, rb_node);
+
+ if (!cpu_seen[__t->bit->cpu]) {
+ cpu_seen[__t->bit->cpu] = 1;
+ cpus++;
+ }
+ n = rb_next(n);
+ }
+
+ free(cpu_seen);
+ return cpus != pdi->nopenfiles;
+ }