eventmon - monitor internal kernel events
eventmon is a test program for developers, which shows how to monitor kernel events efficiently.It opens the device /dev/events twice, binding to two different event sources. It then sleeps using select() until events occur. You can consult the source code to see how to do it.
The first source, sched-class, which eventmon registers with informs the program when any change of scheduling policy occurs to another task. The second, sched-expired, fires when a program using SCHED_QOS overruns its time allocation in a particular period. The intended use is to generate feedback for the user, for example by graphically indicating which processes are currently real-time.
The kernel events device supports multicast so you can start eventmon several times; each instance will receive all the events. It's also designed to be easily extensible, so hackers can create their own event sources and make the kernel fire them when particular conditions of interest occur.
/proc/events
/dev/events
If you give an application a short time period and insufficient CPU slice, you will probably be swamped with overrun events. The mechanism should be efficient enough to cope but eventmon will be very busy printing the messages.
David Ingram <dmi@uk.research.att.com>