"Unable" to read output through pipes - large buffer size
enhaut opened this issue · comments
Samuel commented
Default large pipe buffer (64KiB on linux) causes issues with reading xdp-bench
output using pipes.
I am actually trying to read xdp-bench
output for further analysis, i am simply piping stdout
to stdin
of my application, however due to large pipe buffer stdout
seems to be empty.
There are multiple ways to resolve this issue:
- set size of
stdout
(and eventuallystderr
) buffer to0
so prints will be immediately flushed/printed to stdout - flushing
stdout
buffer usingfflush(stdout)
once a while e.g. right after summary/sample line is printed:xdp-tools/lib/util/xdp_sample.c
Line 1119 in 00ff5bf
- setting system-wide pipe buffer size. However, I think that's pretty clumsy
I've got a first option implemented and tested in my fork, see commit c608351
Toke Høiland-Jørgensen commented
Hmm, fair point. I think I would prefer to add an explicit flush after newline; care to open a pull request to do that? :)