From eb3101a40fe446cffab677a7d117f028bae9afba Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 9 Mar 2009 10:06:20 -0500 Subject: First working version that actually produces output. 2009-03-09 David Smith * 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. --- runtime/print_new.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'runtime/print_new.c') 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); -- cgit