stpd and stdout

Hien Nguyen hien@us.ibm.com
Tue May 9 22:21:00 GMT 2006


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?

Thanks, Hien.

--- librelay.c  2006-05-09 14:49:07.000000000 -0700
+++ librelay.c.new      2006-05-09 14:34:48.000000000 -0700
@@ -789,6 +789,7 @@
                }
                case STP_REALTIME_DATA:
                        fwrite_unlocked(data, nb - sizeof(int), 1, ofp);
+                       fflush_unlocked(ofp);
                        break;
                case STP_OOB_DATA:
                        fputs ((char *)data, stderr);




More information about the Systemtap mailing list