diff options
author | David Smith <dsmith@redhat.com> | 2009-03-11 12:54:19 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-03-11 12:54:19 -0500 |
commit | 49f34ab20c2afd95b6a34a904563d456d6deb1d1 (patch) | |
tree | 32e953665acd5e40187dc6536bc5a0f51e28deb0 /runtime/print_new.c | |
parent | ef20115ab2d3d5d1a2e9fca84eff53c7430a24c6 (diff) | |
download | systemtap-steved-49f34ab20c2afd95b6a34a904563d456d6deb1d1.tar.gz systemtap-steved-49f34ab20c2afd95b6a34a904563d456d6deb1d1.tar.xz systemtap-steved-49f34ab20c2afd95b6a34a904563d456d6deb1d1.zip |
Handles polling and breaks down large buffers.
2009-03-11 David Smith <dsmith@redhat.com>
* 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.
Diffstat (limited to 'runtime/print_new.c')
-rw-r--r-- | runtime/print_new.c | 30 |
1 files changed, 29 insertions, 1 deletions
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 */ |