diff options
author | hunt <hunt> | 2007-03-14 16:13:33 +0000 |
---|---|---|
committer | hunt <hunt> | 2007-03-14 16:13:33 +0000 |
commit | 8c235ce57600584d3126ad86520b4fb44765c8ec (patch) | |
tree | 4a7ee542bda895a54edbb5863d68bce19d4f135f /runtime/print.c | |
parent | fbbb89fffb3533a3b4fb63c15eaeaae6956391eb (diff) | |
download | systemtap-steved-8c235ce57600584d3126ad86520b4fb44765c8ec.tar.gz systemtap-steved-8c235ce57600584d3126ad86520b4fb44765c8ec.tar.xz systemtap-steved-8c235ce57600584d3126ad86520b4fb44765c8ec.zip |
2007-03-14 Martin Hunt <hunt@redhat.com>
* bench2/bench.rb: Updated to work with new transport
and new itest.c.
* bench2/Makefile: Updated for new itest.c
* bench2/itest.c: Rewritten to use multiple threads
and automatically divide the workload among the threads.
* print.c (_stp_print_flush): Move to print_new.c and
print_old.c.
* print_new.c: New file containing _stp_print_flush()
for the new transport.
* print_old.c: Ditto for old transport.
* runtime.h (STP_OLD_TRANSPORT): Define
(errk): Define.
(MAXSTRINGLEN): Define if not already defined.
* io.c (_stp_vlog): Use _stp_ctl_write().
Diffstat (limited to 'runtime/print.c')
-rw-r--r-- | runtime/print.c | 57 |
1 files changed, 8 insertions, 49 deletions
diff --git a/runtime/print.c b/runtime/print.c index b4c7bc49..c100bbfe 100644 --- a/runtime/print.c +++ b/runtime/print.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Print Functions - * Copyright (C) 2005, 2006, 2007 Red Hat Inc. + * Copyright (C) 2007 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -11,6 +11,7 @@ #ifndef _PRINT_C_ #define _PRINT_C_ + #include "string.h" #include "vsprintf.c" #include "transport/transport.c" @@ -33,18 +34,8 @@ * @{ */ -#ifdef STP_RELAYFS -#define STP_TIMESTAMP_SIZE (sizeof(uint32_t)) -#else -#define STP_TIMESTAMP_SIZE 0 -#endif /* STP_RELAYFS */ - - -#define STP_PRINT_BUF_START (STP_TIMESTAMP_SIZE) - typedef struct __stp_pbuf { uint32_t len; /* bytes used in the buffer */ - char timestamp[STP_TIMESTAMP_SIZE]; char buf[STP_BUFFER_SIZE]; } _stp_pbuf; @@ -81,37 +72,15 @@ void _stp_print_cleanup (void) free_percpu(Stp_lbuf); } -/** Send the print buffer to the transport now. - * Output accumulates in the print buffer until it - * is filled, or this is called. This MUST be called before returning - * from a probe or accumulated output in the print buffer will be lost. - * - * @note Preemption must be disabled to use this. - */ -void _stp_print_flush (void) -{ - _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); - - /* check to see if there is anything in the buffer */ - if (likely (pb->len == 0)) - return; - -#ifdef STP_RELAYFS_MERGE - /* In merge-mode, staprun expects relayfs data to start with a 4-byte length */ - /* followed by a 4-byte sequence number. In non-merge mode, anything goes. */ +/* The relayfs API changed between 2.6.15 and 2.6.16. */ +/* Use the appropriate print flush function. */ - *((uint32_t *)pb->timestamp) = _stp_seq_inc(); - - if (unlikely(_stp_transport_write(pb, pb->len+4+STP_TIMESTAMP_SIZE) < 0)) - atomic_inc (&_stp_transport_failures); +#ifdef STP_OLD_TRANSPORT +#include "print_old.c" #else - if (unlikely(_stp_transport_write(pb->buf, pb->len) < 0)) - atomic_inc (&_stp_transport_failures); +#include "print_new.c" #endif - pb->len = 0; -} - #ifndef STP_MAXBINARYARGS #define STP_MAXBINARYARGS 127 #endif @@ -119,16 +88,6 @@ void _stp_print_flush (void) /** Reserves space in the output buffer for direct I/O. */ - -#if defined STP_RELAYFS && !defined STP_RELAYFS_MERGE -static void * _stp_reserve_bytes (int numbytes) -{ - if (unlikely(numbytes == 0)) - return NULL; - _stp_print_flush(); - return relay_reserve(_stp_chan, numbytes); -} -#else static void * _stp_reserve_bytes (int numbytes) { _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); @@ -145,7 +104,7 @@ static void * _stp_reserve_bytes (int numbytes) pb->len += numbytes; return ret; } -#endif /* STP_RELAYFS */ + /** Write 64-bit args directly into the output stream. * This function takes a variable number of 64-bit arguments |