From 49f34ab20c2afd95b6a34a904563d456d6deb1d1 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 11 Mar 2009 12:54:19 -0500 Subject: Handles polling and breaks down large buffers. 2009-03-11 David Smith * print_new.c (stp_print_flush): Breaks up the buffer into smaller pieces (since the ring_buffer likes lots of small events, not one large one). * transport/ring_buffer.c (__stp_alloc_ring_buffer): Reserves space for struct _stp_entry. (_stp_data_poll_trace): New function. (_stp_data_write_commit): Wakes up any tasks waiting on data. --- runtime/print_new.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'runtime/print_new.c') diff --git a/runtime/print_new.c b/runtime/print_new.c index 2759ebcf..4e579c37 100644 --- a/runtime/print_new.c +++ b/runtime/print_new.c @@ -60,13 +60,41 @@ void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb) dbug_trans(1, "calling _stp_data_write...\n"); spin_lock_irqsave(&_stp_print_lock, flags); +#if 0 entry = _stp_data_write_reserve(len); if (likely(entry)) { memcpy(entry->buf, pb->buf, len); _stp_data_write_commit(entry); } else - atomic_inc (&_stp_transport_failures); +#endif + { + uint32_t cnt; + char *bufp = pb->buf; + +#define MAX_RESERVE_SIZE (4080 /*BUF_PAGE_SIZE*/ - sizeof(struct _stp_entry) - 8) + while (len > 0) { + if (len > MAX_RESERVE_SIZE) { + len -= MAX_RESERVE_SIZE; + cnt = MAX_RESERVE_SIZE; + } + else { + cnt = len; + len = 0; + } + + entry = _stp_data_write_reserve(cnt); + if (likely(entry)) { + memcpy(entry->buf, bufp, cnt); + _stp_data_write_commit(entry); + bufp += cnt; + } + else { + atomic_inc (&_stp_transport_failures); + break; + } + } + } spin_unlock_irqrestore(&_stp_print_lock, flags); } #endif /* STP_BULKMODE */ -- cgit