xdp-project / xdp-tools

Utilities and example programs for use with XDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Unable" to read output through pipes - large buffer size

enhaut opened this issue · comments

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 eventually stderr) buffer to 0 so prints will be immediately flushed/printed to stdout
  • flushing stdout buffer using fflush(stdout) once a while e.g. right after summary/sample line is printed:
    printf("\n");
  • 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

Hmm, fair point. I think I would prefer to add an explicit flush after newline; care to open a pull request to do that? :)