Keeping track of the CPU time for a thread

Adam Lackorzynski adam at
Sun Jun 24 23:29:25 CEST 2012


On Thu Jun 21, 2012 at 17:44:25 +0000, Mohammad A Haque wrote:
> I want to measure how much CPU time a thread has consumed. When the
> CPU time consumption exceeds a certain limit (specific to that
> thread), I want to raise an interrupt. Please suggest me how can I do
> it efficiently?

The L4::Thread interface has the stats_time function to get the consumed
time of a thread (FINE_GRAINED_CPUTIME in the kernel might be of
interest here). Triggering an interrupt goes with its trigger function.
Then it's just about plugging this together.

Adam                 adam at

More information about the l4-hackers mailing list