index b2288b3ad8157679d5101484b77801819781f352..b4447891b9fa2524573e80615f62dc147ec06b12 100644 (file)
--- a/driver/gator_annotate.c
+++ b/driver/gator_annotate.c
if (*offset)
return -EINVAL;
- if (!collect_annotations) {
+ if (!collect_annotations)
+ // Not collecting annotations, tell the caller everything was written
return count_orig;
- }
cpu = 0; // Annotation only uses a single per-cpu buffer as the data must be in order to the engine
size = count < available ? count : available;
if (size <= 0) {
+ // Buffer is full but don't return an error. Instead return 0 so the
+ // caller knows nothing was written and they can try again.
size = 0;
goto annotate_write_out;
}
// synchronize between cores
spin_lock(&annotate_lock);
- if (per_cpu(gator_buffer, cpu)[ANNOTATE_BUF] && buffer_check_space(cpu, ANNOTATE_BUF, MAXSIZE_PACK64 + 2 * MAXSIZE_PACK32)) {
+ if (per_cpu(gator_buffer, cpu)[ANNOTATE_BUF] && buffer_check_space(cpu, ANNOTATE_BUF, MAXSIZE_PACK64 + 3 * MAXSIZE_PACK32)) {
uint32_t tid = current->pid;
+ gator_buffer_write_packed_int(cpu, ANNOTATE_BUF, smp_processor_id());
gator_buffer_write_packed_int(cpu, ANNOTATE_BUF, tid);
gator_buffer_write_packed_int64(cpu, ANNOTATE_BUF, 0); // time
gator_buffer_write_packed_int(cpu, ANNOTATE_BUF, 0); // size