Hi,

Thanks for the wonderful work on dt(4) and the btrace tool.

I noticed while using the btrace program:

btrace -e 'tracepoint:uvm:malloc { printf("%s[%d]: malloc(%d)\n", comm, pid, 
arg0); }' | \
        grep -v Xorg

The output of btrace is unbuffered and grep does not filter the line, until the
buffer is full of course.

The below patch flushes stdout after a printf call, does it make sense?


diff --git usr.sbin/btrace/printf.c usr.sbin/btrace/printf.c
index d7a9424dce6..89f464bc551 100644
--- usr.sbin/btrace/printf.c
+++ usr.sbin/btrace/printf.c
@@ -220,6 +220,8 @@ stmt_printf(struct bt_stmt *bs, struct dt_evt *des)
                }
        } while (gargv != NULL);
 
+       fflush(stdout);
+
        return (rval);
 }
 
-- 
Kind regards,
Hiltjo

Reply via email to