kernelspace -> userspace communication

Matthew Dillon dillon at
Mon Jun 4 08:20:48 PDT 2007

:I'd like to move some trivial kernel stats to userspace for further 
:examination. ktr seems ok for small amounts of data gathered in a small time 
:period. Periodically running ktrdump (polling the ktr indexes and using the 
:timestamps to know when you've missed any events) would probably work, but 
:it's a rather dumb solution. Am I missing some other mechanism?

    KTR is the best way to log realtime data.

    The kernel just maintains a per-cpu memory buffer and operates it like
    a FIFO, with a revovling read and write index.  There is nothing
    preventing ktrdump from sticking around and polling the FIFO for
    new events, then only reporting the new information.

    It would take maybe an hour for a good programmer to modify ktrdump to
    do that.  It isn't difficult at all.  I eagerly away your patch! :-)

					Matthew Dillon 
					<dillon at>

More information about the Kernel mailing list