ring-buffer: fix timestamp in partial ring_buffer_page_read
If a partial ring_buffer_page_read happens, then some of the incremental timestamps may be lost. This patch writes the recent timestamp into the page that is passed back to the caller. A partial ring_buffer_page_read is where the full page would not be written back to the user, and instead, just part of the page is copied to the user. A full page would be a page swap with the ring buffer and the timestamps would be correct. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
This commit is contained in:
Родитель
e543ad7691
Коммит
4f3640f8a3
|
@ -2461,6 +2461,7 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned int commit;
|
unsigned int commit;
|
||||||
unsigned int read;
|
unsigned int read;
|
||||||
|
u64 save_timestamp;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2515,6 +2516,9 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
|
||||||
if (len < size)
|
if (len < size)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
/* save the current timestamp, since the user will need it */
|
||||||
|
save_timestamp = cpu_buffer->read_stamp;
|
||||||
|
|
||||||
/* Need to copy one event at a time */
|
/* Need to copy one event at a time */
|
||||||
do {
|
do {
|
||||||
memcpy(bpage->data + pos, rpage->data + rpos, size);
|
memcpy(bpage->data + pos, rpage->data + rpos, size);
|
||||||
|
@ -2531,7 +2535,7 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
|
||||||
|
|
||||||
/* update bpage */
|
/* update bpage */
|
||||||
local_set(&bpage->commit, pos);
|
local_set(&bpage->commit, pos);
|
||||||
bpage->time_stamp = rpage->time_stamp;
|
bpage->time_stamp = save_timestamp;
|
||||||
|
|
||||||
/* we copied everything to the beginning */
|
/* we copied everything to the beginning */
|
||||||
read = 0;
|
read = 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче