public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Martin Hunt <hunt@redhat.com>
To: Hien Nguyen <hien@us.ibm.com>
Cc: SystemTAP <systemtap@sources.redhat.com>
Subject: Re: stpd and stdout
Date: Thu, 18 May 2006 17:56:00 -0000	[thread overview]
Message-ID: <1147975015.2562.7.camel@localhost.localdomain> (raw)
In-Reply-To: <446115E6.4000302@us.ibm.com>

On Tue, 2006-05-09 at 15:21 -0700, Hien Nguyen wrote:
> Hi Martin,
> 
> While working on the the systemtap GUI we run into the problem of 
> getting the stdout to the gui app in a timely fashion. We does get the 
> output as a blob of text once in a while (looks like data were only 
> flushed out when the buffer is full). To recreate the problem you can 
> try this
> 
> stap -e 'probe syscall.open{ log(filename) }' | tee
> 
> Anyway, I added one line of code to flushout the data as soon as the 
> stpd gets it. It seems to solve the above problem. To avoid unnecessary 
> performance issues for others, perhaps we should have that as an option. 
> What do you think?

I think that in this case (stdout from procfs) it should always be
line-buffered. No option is necessary.  In fact I tried it and couldn't
measure any significant performance advantage for full buffering.  I've
gone ahead and committed the following patch.  Let me know how it works.

Index: librelay.c
===================================================================
RCS file: /cvs/systemtap/src/runtime/stpd/librelay.c,v
retrieving revision 1.37
diff -u -r1.37 librelay.c
--- librelay.c  8 Apr 2006 21:59:36 -0000       1.37
+++ librelay.c  18 May 2006 17:51:31 -0000
@@ -722,6 +722,7 @@
        int type;
        FILE *ofp = stdout;

+       setvbuf(ofp, (char *)NULL, _IOLBF, 0);
        pthread_mutex_init(&processing_mutex, NULL);

        signal(SIGINT, sigproc);


  reply	other threads:[~2006-05-18 17:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09 22:21 Hien Nguyen
2006-05-18 17:56 ` Martin Hunt [this message]
2006-05-18 20:42   ` Hien Nguyen
2006-05-09 22:57 Stone, Joshua I

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1147975015.2562.7.camel@localhost.localdomain \
    --to=hunt@redhat.com \
    --cc=hien@us.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).