[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Date: Tue, 26 Sep 2000 09:41:49 -0500
- From: joel.sherrill at OARcorp.com (Joel Sherrill)
- Subject: Processor Load
William Halliburton wrote:
> Is there an easy way to get/calculate information on the amount of time the
> system is spending in user/system/idle?
See the code in libmisc/cpuuse. It is 100% portable across all RTEMS
accurate to within a clock tick. As mentioned by the numerous replies,
based on a clock tick is not 100% accurate. There are cases that cloud
+ tasks that run less than a clock tick
+ tasks that start between ticks N and N+1 and end between N+1 and
The code in cpuuse takes a simple approach. Starting to execute is
as "1 tick". Each time a clock tick occurs, the per task counter is
This is a reasonably accurate after things run even a short while. We
decision that something had to be recorded each time a task executed.
if a task completely executes between two clock ticks, it would have
recorded as 0.
The most accurate solution is to have a counter/time that is checked
a task switch occurs. Then the outgoing task is "charged" for the time
Again anything based on a clock tick is just an approximation. It can
enough though to make VERY good system analysis and tuning decisions.
If your application uses rate monotonic periods, the libmisc/rtmonuse
fabulously useful for tuning applications. :)
> Thank you,
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985