If you compile the latest sflowtool, it has an option for this.
cd sflowtool
./boot.sh
./configure
make
sudo make install
and then:
will sample the packets at 1:100 and send to local UDP port 7777. You can confirm they are arriving by running:
sflowtool -p 7777
in another window.
I plan to add options to set the agent address (it currently comes out as 0.0.0.0), and to compress time so you can "playback" at different speeds (or as fast as possible).
The encoding routines in sflow_xdr.h are experimental and have not been tested thoroughly, so please let me know if you find bugs.
(I was curious to see how efficiently the XDR encoding could be done. The old sFlow encoding library does a lot of redundant copying and cross-checking.)