|
|
@ -219,9 +219,12 @@ impl PerfBuffer {
|
|
|
|
|
|
|
|
|
|
|
|
let head = unsafe { (*header).data_head } as usize;
|
|
|
|
let head = unsafe { (*header).data_head } as usize;
|
|
|
|
let mut tail = unsafe { (*header).data_tail } as usize;
|
|
|
|
let mut tail = unsafe { (*header).data_tail } as usize;
|
|
|
|
while head != tail {
|
|
|
|
let result = loop {
|
|
|
|
|
|
|
|
if head == tail {
|
|
|
|
|
|
|
|
break Ok(());
|
|
|
|
|
|
|
|
}
|
|
|
|
if buf_n == buffers.len() {
|
|
|
|
if buf_n == buffers.len() {
|
|
|
|
break;
|
|
|
|
break Ok(());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let buf = &mut buffers[buf_n];
|
|
|
|
let buf = &mut buffers[buf_n];
|
|
|
@ -243,18 +246,16 @@ impl PerfBuffer {
|
|
|
|
Err(e) => {
|
|
|
|
Err(e) => {
|
|
|
|
// we got an error and we didn't process any events, propagate the error
|
|
|
|
// we got an error and we didn't process any events, propagate the error
|
|
|
|
// and give the caller a chance to increase buffers
|
|
|
|
// and give the caller a chance to increase buffers
|
|
|
|
atomic::fence(Ordering::SeqCst);
|
|
|
|
break Err(e);
|
|
|
|
unsafe { (*header).data_tail = tail as u64 };
|
|
|
|
|
|
|
|
return Err(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tail += event_size;
|
|
|
|
tail += event_size;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
atomic::fence(Ordering::SeqCst);
|
|
|
|
atomic::fence(Ordering::SeqCst);
|
|
|
|
unsafe { (*header).data_tail = tail as u64 };
|
|
|
|
unsafe { (*header).data_tail = tail as u64 };
|
|
|
|
|
|
|
|
|
|
|
|
Ok(events)
|
|
|
|
result.map(|()| events)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|