From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14913 invoked by alias); 18 May 2006 17:56:59 -0000 Received: (qmail 14906 invoked by uid 22791); 18 May 2006 17:56:59 -0000 X-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 18 May 2006 17:56:57 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k4IHutnd027224; Thu, 18 May 2006 13:56:55 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k4IHusde001713; Thu, 18 May 2006 13:56:54 -0400 Received: from vpn83-174.boston.redhat.com (vpn83-174.boston.redhat.com [172.16.83.174]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id k4IHur6k009229; Thu, 18 May 2006 13:56:54 -0400 Subject: Re: stpd and stdout From: Martin Hunt To: Hien Nguyen Cc: SystemTAP In-Reply-To: <446115E6.4000302@us.ibm.com> References: <446115E6.4000302@us.ibm.com> Content-Type: text/plain Organization: Red Hat Inc. Date: Thu, 18 May 2006 17:56:00 -0000 Message-Id: <1147975015.2562.7.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q2/txt/msg00443.txt.bz2 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);