Lines Matching refs:iter
2255 rb_iter_head_event(struct ring_buffer_iter *iter) in rb_iter_head_event() argument
2258 struct buffer_page *iter_head_page = iter->head_page; in rb_iter_head_event()
2262 if (iter->head != iter->next_event) in rb_iter_head_event()
2263 return iter->event; in rb_iter_head_event()
2274 if (iter->head > commit - 8) in rb_iter_head_event()
2277 event = __rb_page_index(iter_head_page, iter->head); in rb_iter_head_event()
2286 if ((iter->head + length) > commit || length > BUF_PAGE_SIZE) in rb_iter_head_event()
2290 memcpy(iter->event, event, length); in rb_iter_head_event()
2298 if (iter->page_stamp != iter_head_page->page->time_stamp || in rb_iter_head_event()
2302 iter->next_event = iter->head + length; in rb_iter_head_event()
2303 return iter->event; in rb_iter_head_event()
2306 iter->page_stamp = iter->read_stamp = iter->head_page->page->time_stamp; in rb_iter_head_event()
2307 iter->head = 0; in rb_iter_head_event()
2308 iter->next_event = 0; in rb_iter_head_event()
2309 iter->missed_events = 1; in rb_iter_head_event()
2333 static void rb_inc_iter(struct ring_buffer_iter *iter) in rb_inc_iter() argument
2335 struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; in rb_inc_iter()
2343 if (iter->head_page == cpu_buffer->reader_page) in rb_inc_iter()
2344 iter->head_page = rb_set_head_page(cpu_buffer); in rb_inc_iter()
2346 rb_inc_page(cpu_buffer, &iter->head_page); in rb_inc_iter()
2348 iter->page_stamp = iter->read_stamp = iter->head_page->page->time_stamp; in rb_inc_iter()
2349 iter->head = 0; in rb_inc_iter()
2350 iter->next_event = 0; in rb_inc_iter()
4124 static void rb_iter_reset(struct ring_buffer_iter *iter) in rb_iter_reset() argument
4126 struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; in rb_iter_reset()
4129 iter->head_page = cpu_buffer->reader_page; in rb_iter_reset()
4130 iter->head = cpu_buffer->reader_page->read; in rb_iter_reset()
4131 iter->next_event = iter->head; in rb_iter_reset()
4133 iter->cache_reader_page = iter->head_page; in rb_iter_reset()
4134 iter->cache_read = cpu_buffer->read; in rb_iter_reset()
4135 iter->cache_pages_removed = cpu_buffer->pages_removed; in rb_iter_reset()
4137 if (iter->head) { in rb_iter_reset()
4138 iter->read_stamp = cpu_buffer->read_stamp; in rb_iter_reset()
4139 iter->page_stamp = cpu_buffer->reader_page->page->time_stamp; in rb_iter_reset()
4141 iter->read_stamp = iter->head_page->page->time_stamp; in rb_iter_reset()
4142 iter->page_stamp = iter->read_stamp; in rb_iter_reset()
4153 void ring_buffer_iter_reset(struct ring_buffer_iter *iter) in ring_buffer_iter_reset() argument
4158 if (!iter) in ring_buffer_iter_reset()
4161 cpu_buffer = iter->cpu_buffer; in ring_buffer_iter_reset()
4164 rb_iter_reset(iter); in ring_buffer_iter_reset()
4173 int ring_buffer_iter_empty(struct ring_buffer_iter *iter) in ring_buffer_iter_empty() argument
4184 cpu_buffer = iter->cpu_buffer; in ring_buffer_iter_empty()
4210 return ((iter->head_page == commit_page && iter->head >= commit) || in ring_buffer_iter_empty()
4211 (iter->head_page == reader && commit_page == head_page && in ring_buffer_iter_empty()
4213 iter->head == rb_page_commit(cpu_buffer->reader_page))); in ring_buffer_iter_empty()
4248 rb_update_iter_read_stamp(struct ring_buffer_iter *iter, in rb_update_iter_read_stamp() argument
4259 iter->read_stamp += delta; in rb_update_iter_read_stamp()
4264 iter->read_stamp = delta; in rb_update_iter_read_stamp()
4268 iter->read_stamp += event->time_delta; in rb_update_iter_read_stamp()
4272 RB_WARN_ON(iter->cpu_buffer, 1); in rb_update_iter_read_stamp()
4468 static void rb_advance_iter(struct ring_buffer_iter *iter) in rb_advance_iter() argument
4472 cpu_buffer = iter->cpu_buffer; in rb_advance_iter()
4475 if (iter->head == iter->next_event) { in rb_advance_iter()
4477 if (rb_iter_head_event(iter) == NULL) in rb_advance_iter()
4481 iter->head = iter->next_event; in rb_advance_iter()
4486 if (iter->next_event >= rb_page_size(iter->head_page)) { in rb_advance_iter()
4488 if (iter->head_page == cpu_buffer->commit_page) in rb_advance_iter()
4490 rb_inc_iter(iter); in rb_advance_iter()
4494 rb_update_iter_read_stamp(iter, iter->event); in rb_advance_iter()
4576 rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) in rb_iter_peek() argument
4586 cpu_buffer = iter->cpu_buffer; in rb_iter_peek()
4594 if (unlikely(iter->cache_read != cpu_buffer->read || in rb_iter_peek()
4595 iter->cache_reader_page != cpu_buffer->reader_page || in rb_iter_peek()
4596 iter->cache_pages_removed != cpu_buffer->pages_removed)) in rb_iter_peek()
4597 rb_iter_reset(iter); in rb_iter_peek()
4600 if (ring_buffer_iter_empty(iter)) in rb_iter_peek()
4616 if (iter->head >= rb_page_size(iter->head_page)) { in rb_iter_peek()
4617 rb_inc_iter(iter); in rb_iter_peek()
4621 event = rb_iter_head_event(iter); in rb_iter_peek()
4628 rb_inc_iter(iter); in rb_iter_peek()
4631 rb_advance_iter(iter); in rb_iter_peek()
4636 rb_advance_iter(iter); in rb_iter_peek()
4646 rb_advance_iter(iter); in rb_iter_peek()
4651 *ts = iter->read_stamp + event->time_delta; in rb_iter_peek()
4739 bool ring_buffer_iter_dropped(struct ring_buffer_iter *iter) in ring_buffer_iter_dropped() argument
4741 bool ret = iter->missed_events != 0; in ring_buffer_iter_dropped()
4743 iter->missed_events = 0; in ring_buffer_iter_dropped()
4757 ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts) in ring_buffer_iter_peek() argument
4759 struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; in ring_buffer_iter_peek()
4765 event = rb_iter_peek(iter, ts); in ring_buffer_iter_peek()
4849 struct ring_buffer_iter *iter; in ring_buffer_read_prepare() local
4854 iter = kzalloc(sizeof(*iter), flags); in ring_buffer_read_prepare()
4855 if (!iter) in ring_buffer_read_prepare()
4859 iter->event = kmalloc(BUF_PAGE_SIZE, flags); in ring_buffer_read_prepare()
4860 if (!iter->event) { in ring_buffer_read_prepare()
4861 kfree(iter); in ring_buffer_read_prepare()
4867 iter->cpu_buffer = cpu_buffer; in ring_buffer_read_prepare()
4871 return iter; in ring_buffer_read_prepare()
4901 ring_buffer_read_start(struct ring_buffer_iter *iter) in ring_buffer_read_start() argument
4906 if (!iter) in ring_buffer_read_start()
4909 cpu_buffer = iter->cpu_buffer; in ring_buffer_read_start()
4913 rb_iter_reset(iter); in ring_buffer_read_start()
4927 ring_buffer_read_finish(struct ring_buffer_iter *iter) in ring_buffer_read_finish() argument
4929 struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; in ring_buffer_read_finish()
4943 kfree(iter->event); in ring_buffer_read_finish()
4944 kfree(iter); in ring_buffer_read_finish()
4955 void ring_buffer_iter_advance(struct ring_buffer_iter *iter) in ring_buffer_iter_advance() argument
4957 struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; in ring_buffer_iter_advance()
4962 rb_advance_iter(iter); in ring_buffer_iter_advance()