diff options
author | David Smith <dsmith@redhat.com> | 2009-03-09 10:06:20 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-03-09 10:06:20 -0500 |
commit | eb3101a40fe446cffab677a7d117f028bae9afba (patch) | |
tree | 154df4580d8e21d0dad45199637267e6f351e197 /runtime/print_new.c | |
parent | 176b56b261a711822f35e36ec5e2d5e0758770de (diff) | |
download | systemtap-steved-eb3101a40fe446cffab677a7d117f028bae9afba.tar.gz systemtap-steved-eb3101a40fe446cffab677a7d117f028bae9afba.tar.xz systemtap-steved-eb3101a40fe446cffab677a7d117f028bae9afba.zip |
First working version that actually produces output.
2009-03-09 David Smith <dsmith@redhat.com>
* print_new.c (stp_print_flush): Calls _stp_data_write_reserve()
and _stp_data_write_commit().
* transport/ring_buffer.c (__stp_alloc_ring_buffer): Sets up a
default buffer size of STP_BUFFER_SIZE;
(trace_seq_reset): New function.
(peek_next_entry): New function.
(__find_next_entry): New function.
(find_next_entry_inc): New function.
(_stp_data_read_trace): Uses find_next_entry_inc() to get the next
entry, then calls _stp_entry_to_user() to copy it to the user's
buffer, then calls ring_buffer_consume() to consume it.
(_stp_data_write_reserve): New function.
(_stp_data_write_commit): New function.
* transport/transport.c (_stp_transport_close): Calls functions
that were ifdef'ed out.
* transport/transport.h (struct _stp_entry): Added _stp_entry
definition and _stp_data_write_reserve()/_stp_data_write_commit()
prototypes.
Diffstat (limited to 'runtime/print_new.c')
-rw-r--r-- | runtime/print_new.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/runtime/print_new.c b/runtime/print_new.c index bebaa19c..2759ebcf 100644 --- a/runtime/print_new.c +++ b/runtime/print_new.c @@ -23,6 +23,7 @@ void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb) uint32_t len = pb->len; /* check to see if there is anything in the buffer */ + dbug_trans(1, "len = %ud\n", len); if (likely (len == 0)) return; @@ -54,16 +55,16 @@ void EXPORT_FN(stp_print_flush) (_stp_pbuf *pb) } #else { - void *buf; + struct _stp_entry *entry; unsigned long flags; + + dbug_trans(1, "calling _stp_data_write...\n"); spin_lock_irqsave(&_stp_print_lock, flags); -#if 0 - buf = utt_reserve(_stp_utt, len); -#else - buf = NULL; -#endif - if (likely(buf)) - memcpy(buf, pb->buf, len); + 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); spin_unlock_irqrestore(&_stp_print_lock, flags); |